Trait autograd::ops::Op
[−]
[src]
pub trait Op { fn name(&self) -> &str; fn grad(
&self,
gy: &Tensor,
inputs: &[&Tensor],
output: &Tensor
) -> Vec<Option<Tensor>>; fn compute(&mut self, xs: &[&NdArray], train: bool) -> NdArray; }
Represents a operation node in a computation graph.
Tensor
wraps trait-object of this.
Required Methods
fn name(&self) -> &str
Name of this op
fn grad(
&self,
gy: &Tensor,
inputs: &[&Tensor],
output: &Tensor
) -> Vec<Option<Tensor>>
&self,
gy: &Tensor,
inputs: &[&Tensor],
output: &Tensor
) -> Vec<Option<Tensor>>
Returns gradient for each input node by use of output gradient.
Arguments
gy
- Gradient of output of this opinputs
-Tensor
level representation ofcompute::xs
output
-Tensor
level representation ofcompute
's return value
fn compute(&mut self, xs: &[&NdArray], train: bool) -> NdArray
Actually runs this op. num of inputs : N, num of outputs: 1
Implementors
impl Op for DummyOp
impl Op for RandomNormal
impl Op for RandomUniform
impl Op for StandardNormal
impl Op for StandardUniform
impl Op for Bernoulli
impl Op for Exponential
impl Op for LogNormal
impl Op for Gamma