Skip to main content

Crate zyx_derive

Crate zyx_derive 

Source
Expand description

§zyx-derive

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::Tensor;
use zyx_derive::Module;

#[derive(Module)]
struct MyNet {
    b: Tensor,
    w: Tensor,
}

impl MyNet {
    fn forward(&self, x: &Tensor) -> Tensor {
        x.dot(&self.w).unwrap() + &self.b
    }
}

For README, quick tutorial and source code, please visit <https://www.github.com/zk4x/zyx>.

For more details, there is a book.

Derive Macros§

Module
Procedural macro Module