autograd 0.8.0

Tensors and differentiable operations in Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use op;
use tensor::Tensor;

pub struct StopGradient;

impl op::Op for StopGradient {
    fn name(&self) -> &str {
        "StopGradient"
    }

    fn compute(&self, _: ::runtime::OpComputeContext) -> op::ComputeResult {
        vec![Err(::op::ComputeError::Delegate { to: 0 })]
    }

    fn grad(&self, _: &Tensor, _: &[&Tensor], _: &Tensor) -> Vec<Option<Tensor>> {
        vec![None]
    }
}