[−][src]Trait auto_diff::op::OpTrait
All op is OpTrait
Required methods
fn get_name(&self) -> String
fn apply(&mut self, input: &[&Tensor], output: &[&Tensor])
[−]
Forward pass
fn grad(
&self,
input: &[&Tensor],
output_grad: &[&Tensor],
input_grad: &[&Tensor]
)
[−]
&self,
input: &[&Tensor],
output_grad: &[&Tensor],
input_grad: &[&Tensor]
)
Given the forward input value and backward output_grad, Update weight gradient. return backward input gradeint.
fn get_values(&self) -> Vec<&Tensor>
[−]
access weight values
fn set_values(&self, v: &[Tensor])
fn get_grads(&self) -> Vec<&Tensor>
[−]
access gradient values
Implementors
impl OpTrait for Linear
[src][−]
fn get_name(&self) -> String
[src]
fn apply(&mut self, input: &[&Tensor], output: &[&Tensor])
[src]
fn grad(
&self,
input: &[&Tensor],
output_grad: &[&Tensor],
input_grad: &[&Tensor]
)
[src]
&self,
input: &[&Tensor],
output_grad: &[&Tensor],
input_grad: &[&Tensor]
)
fn get_values(&self) -> Vec<&Tensor>
[src]
fn set_values(&self, v: &[Tensor])
[src]
fn get_grads(&self) -> Vec<&Tensor>
[src]
impl OpTrait for Add
[src][−]
fn get_name(&self) -> String
[src]
fn apply(&mut self, input: &[&Tensor], output: &[&Tensor])
[src]
fn grad(
&self,
input: &[&Tensor],
output_grad: &[&Tensor],
input_grad: &[&Tensor]
)
[src]
&self,
input: &[&Tensor],
output_grad: &[&Tensor],
input_grad: &[&Tensor]
)
fn get_values(&self) -> Vec<&Tensor>
[src]
fn get_grads(&self) -> Vec<&Tensor>
[src]
fn set_values(&self, v: &[Tensor])
[src]
impl OpTrait for Div
[src][−]
fn get_name(&self) -> String
[src]
fn apply(&mut self, input: &[&Tensor], output: &[&Tensor])
[src]
fn grad(
&self,
input: &[&Tensor],
output_grad: &[&Tensor],
input_grad: &[&Tensor]
)
[src]
&self,
input: &[&Tensor],
output_grad: &[&Tensor],
input_grad: &[&Tensor]
)
fn get_values(&self) -> Vec<&Tensor>
[src]
fn get_grads(&self) -> Vec<&Tensor>
[src]
fn set_values(&self, v: &[Tensor])
[src]
impl OpTrait for Mul
[src][−]
fn get_name(&self) -> String
[src]
fn apply(&mut self, input: &[&Tensor], output: &[&Tensor])
[src]
fn grad(
&self,
input: &[&Tensor],
output_grad: &[&Tensor],
input_grad: &[&Tensor]
)
[src]
&self,
input: &[&Tensor],
output_grad: &[&Tensor],
input_grad: &[&Tensor]
)
fn get_values(&self) -> Vec<&Tensor>
[src]
fn get_grads(&self) -> Vec<&Tensor>
[src]
fn set_values(&self, v: &[Tensor])
[src]
impl OpTrait for Sub
[src][−]
fn get_name(&self) -> String
[src]
fn apply(&mut self, input: &[&Tensor], output: &[&Tensor])
[src]
fn grad(
&self,
input: &[&Tensor],
output_grad: &[&Tensor],
input_grad: &[&Tensor]
)
[src]
&self,
input: &[&Tensor],
output_grad: &[&Tensor],
input_grad: &[&Tensor]
)
fn get_values(&self) -> Vec<&Tensor>
[src]
fn get_grads(&self) -> Vec<&Tensor>
[src]
fn set_values(&self, v: &[Tensor])
[src]
impl OpTrait for BCEWithLogitsLoss
[src][−]
fn get_name(&self) -> String
[src]
fn apply(&mut self, input: &[&Tensor], output: &[&Tensor])
[src][−]
The first is the prediction, the second input is the label
fn grad(
&self,
input: &[&Tensor],
output_grad: &[&Tensor],
input_grad: &[&Tensor]
)
[src][−]
&self,
input: &[&Tensor],
output_grad: &[&Tensor],
input_grad: &[&Tensor]
)
Given the forward input value and backward output_grad, Update weight gradient. return backward input gradeint.
fn get_values(&self) -> Vec<&Tensor>
[src][−]
access weight values
fn set_values(&self, v: &[Tensor])
[src]
fn get_grads(&self) -> Vec<&Tensor>
[src][−]
access gradient values
impl OpTrait for MSELoss
[src][−]
fn get_name(&self) -> String
[src]
fn apply(&mut self, input: &[&Tensor], output: &[&Tensor])
[src]
fn grad(
&self,
input: &[&Tensor],
output_grad: &[&Tensor],
input_grad: &[&Tensor]
)
[src]
&self,
input: &[&Tensor],
output_grad: &[&Tensor],
input_grad: &[&Tensor]
)