[][src]Trait auto_diff::op::OpTrait

pub trait OpTrait {
    fn get_name(&self) -> String;
fn get_input_size(&self) -> usize;
fn get_output_size(&self) -> usize;
fn apply(&mut self, input: &[&Tensor], output: &[&Tensor]);
fn grad(
        &self,
        input: &[&Tensor],
        output_grad: &[&Tensor],
        input_grad: &[&Tensor]
    );
fn get_values(&self) -> Vec<&Tensor>;
fn set_values(&self, v: &[Tensor]);
fn get_grads(&self) -> Vec<&Tensor>; fn call(&mut self, input: &[&Tensor]) -> Vec<Tensor> { ... } }

All op is OpTrait

Required methods

fn get_name(&self) -> String

fn get_input_size(&self) -> usize

fn get_output_size(&self) -> usize

fn apply(&mut self, input: &[&Tensor], output: &[&Tensor])

Forward pass

fn grad(
    &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

Loading content...

Provided methods

fn call(&mut self, input: &[&Tensor]) -> Vec<Tensor>

Loading content...

Implementors

impl OpTrait for Conv2d[src]

fn apply(&mut self, input: &[&Tensor], output: &[&Tensor])[src]

Forward pass

fn grad(
    &self,
    input: &[&Tensor],
    output_grad: &[&Tensor],
    input_grad: &[&Tensor]
)
[src]

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 get_grads(&self) -> Vec<&Tensor>[src]

access gradient values

impl OpTrait for Linear[src]

impl OpTrait for Add[src]

impl OpTrait for Div[src]

impl OpTrait for Mul[src]

impl OpTrait for Sub[src]

impl OpTrait for BCEWithLogitsLoss[src]

fn apply(&mut self, input: &[&Tensor], output: &[&Tensor])[src]

The first is the prediction, the second input is the label ORDER IS IMPORTANT, SECOND ARGUMENT WON'T GET GRADEINT.

fn grad(
    &self,
    input: &[&Tensor],
    output_grad: &[&Tensor],
    input_grad: &[&Tensor]
)
[src]

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 get_grads(&self) -> Vec<&Tensor>[src]

access gradient values

impl OpTrait for CrossEntropyLoss[src]

fn apply(&mut self, input: &[&Tensor], output: &[&Tensor])[src]

The first is the prediction, the second input is the label ORDER IS IMPORTANT, SECOND ARGUMENT WON'T GET GRADEINT.

fn grad(
    &self,
    input: &[&Tensor],
    output_grad: &[&Tensor],
    input_grad: &[&Tensor]
)
[src]

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 get_grads(&self) -> Vec<&Tensor>[src]

access gradient values

impl OpTrait for MSELoss[src]

impl OpTrait for ELU[src]

fn apply(&mut self, input: &[&Tensor], output: &[&Tensor])[src]

Forward pass

fn grad(
    &self,
    input: &[&Tensor],
    output_grad: &[&Tensor],
    input_grad: &[&Tensor]
)
[src]

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 get_grads(&self) -> Vec<&Tensor>[src]

access gradient values

impl OpTrait for ReLU[src]

fn apply(&mut self, input: &[&Tensor], output: &[&Tensor])[src]

Forward pass

fn grad(
    &self,
    input: &[&Tensor],
    output_grad: &[&Tensor],
    input_grad: &[&Tensor]
)
[src]

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 get_grads(&self) -> Vec<&Tensor>[src]

access gradient values

impl OpTrait for Sigmoid[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]

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 get_grads(&self) -> Vec<&Tensor>[src]

access gradient values

impl OpTrait for Sine[src]

fn apply(&mut self, input: &[&Tensor], output: &[&Tensor])[src]

Forward pass

fn grad(
    &self,
    input: &[&Tensor],
    output_grad: &[&Tensor],
    input_grad: &[&Tensor]
)
[src]

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 get_grads(&self) -> Vec<&Tensor>[src]

access gradient values

impl OpTrait for Nop[src]

fn apply(&mut self, input: &[&Tensor], output: &[&Tensor])[src]

Forward pass

fn get_values(&self) -> Vec<&Tensor>[src]

access weight values

fn get_grads(&self) -> Vec<&Tensor>[src]

access gradient values

impl OpTrait for View[src]

fn get_grads(&self) -> Vec<&Tensor>[src]

access gradient values

Loading content...