Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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)
- Host: GitHub
- URL: https://github.com/alisinabh/nx_metal
- Owner: alisinabh
- License: apache-2.0
- Created: 2023-03-22T01:54:29.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-08-08T20:57:06.000Z (over 1 year ago)
- Last Synced: 2024-10-13T09:57:02.172Z (3 months ago)
- Language: Objective-C
- Size: 68.4 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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]
>