Crates.io | zyx-derive |
lib.rs | zyx-derive |
version | 0.1.1 |
source | src |
created_at | 2024-03-09 17:02:33.208351 |
updated_at | 2024-03-21 16:35:49.320918 |
description | Zyx procedural macros |
homepage | https://github.com/zk4x/zyx |
repository | https://github.com/zk4x/zyx |
max_upload_size | |
id | 1167975 |
size | 8,112 |
This crate contains procedural macros for zyx.
Macro Module automatically implements IntoIterator<Item = &Tensor> for your module, so that you can use it in backpropagation and save it to disk.
use zyx_core::backend::Backend;
use zyx_core::tensor::Tensor;
#[derive(Module)]
struct MyNet<B: Backend> {
b: Tensor<B>,
w: Tensor<B>,
}
impl<B: Backend> MyNet<B> {
fn forward(&self, x: &Tensor<B>) -> Tensor<B> {
x.dot(self.w) + self.b
}
}
For README and source code, please visit github.
For more details, there is a book.