wasm-nn is a deep learning framework for WebAssembly (Wasm) that allows you to train and deploy neural networks in the browser or on the server. It has Python bindings that are compatible with PyTorch, so you can use your existing PyTorch code and models with wasm-nn.
To install wasm-nn, you need to have Rust and wasm-pack installed on your system. Then, you can install wasm-nn with the following command:
bash
wasm-pack install wasm-nn
[dependencies]
wasm-nn = "0.1.0"
Then, you can use it in your Rust code like this:
``` extern crate wasm_nn;
use wasmnn::tensor::Tensor; use wasmnn::optim::SGD; use wasm_nn::nn::{Module, Linear};
fn main() { let mut model = Linear::new(2, 3); let optimizer = SGD::default();
// Train the model on some data...
} ```
To use wasm-nn with Python, you can install the Python package with pip:
python
pip install wasm-nn
Then, you can use it in your Python code like this:
```python import wasm_nn
model = wasmnn.Linear(2, 3) optimizer = wasmnn.SGD()
```
For more details on how to use wasm-nn, see the API documentation.
We welcome contributions to wasm-nn! If you'd like to contribute, please read our contribution guidelines and open a pull request.
wasm-nn is licensed under the MIT License.
wasm-nn is built on top of the WasmBindgen project, which makes it easy to interface between Rust and JavaScript. We are grateful to the WasmBindgen team and community for their efforts in making Wasm development a pleasure.