Skip to content

Commit

Permalink
Added docs for Autograd derive.
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-r-earp committed Oct 30, 2021
1 parent 4be7f26 commit aa17929
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions autograph_derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,28 @@ struct MyNetwork {
layer2: Option<MyLayer>,
}
```
Autograd can be derived as well for structs.
```
#[derive(Autograd)]
struct DenseBackward {
// Use vertex / optional_vertex for Variables and Parameters
#[autograph(vertex)]
input: Variable2,
#[autograph(vertex)]
weight: Parameter2,
#[autograph(optional_vertex)]
bias: Option<Parameter1>,
}
#[derive(Autograd)]
struct ReluBackward {
// Use gradient / optional_gradient for VariableGradient and ParameterGradient
#[autograph(gradient)]
input_grad: VariableGradientD,
output: FloatArcTensorD,
}
```
*/

use proc_macro::TokenStream;
Expand Down

0 comments on commit aa17929

Please sign in to comment.