Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/alisinabh/nx_metal

Metal backend for Numerical Elixir (Nx)
https://github.com/alisinabh/nx_metal

Last synced: about 2 months ago
JSON representation

Metal backend for Numerical Elixir (Nx)

Awesome Lists containing this project

README

        

# NxMetal

Numrical Elixir (Nx) backend for Apple Metal framework. This will enable Nx to operate on Apple GPUs.
This also includes Apple Silicon M1/M2 chips.

*WARNING*: This library is not ready to use and just in the POC (Proof of concept phase).

## Installation

Add `nx_metal` to your list of dependencies in `mix.exs`:

```elixir
def deps do
[
{:nx_metal, github: "alisinabh/nx_metal"}
]
end
```

## Example

```elixir
iex> a = Nx.tensor([1.0, 2.1, 3.3], backend: NxMetal.Backend)
#Nx.Tensor<
f32[3]
NxMetal.Backend
[1.0, 2.0999999046325684, 3.299999952316284]
>
iex> b = Nx.tensor([3.1, 4.2, 8.0], backend: NxMetal.Backend)
#Nx.Tensor<
f32[3]
NxMetal.Backend
[3.0999999046325684, 4.199999809265137, 8.0]
>
iex> Nx.add(a, b)
#Nx.Tensor<
f32[3]
NxMetal.Backend
[4.099999904632568, 6.299999713897705, 11.300000190734863]
>