Trait alumina::ops::Operation [] [src]

pub trait Operation: OperationClone {
    fn name(&self) -> &str;
    fn propagate_shape_constraints(
        &self,
        nodes: &[Node],
        shapes: &mut [NodeShape]
    ); fn num_params(&self) -> usize; fn input_node_IDs(&self) -> Vec<NodeID>; fn output_node_IDs(&self) -> Vec<NodeID>; fn forward(&mut self, data: &mut [RefCell<NodeData>], params: &[f32]); fn backward(
        &mut self,
        data: &mut [RefCell<NodeData>],
        params: &[f32],
        param_deriv: &mut [f32],
        error: &mut f32
    ); fn init_params(&mut self, params: &mut [f32]) { ... } }

Required Methods

should update output node values based on input node values. Must use += when writing to output node.

Should calculate error gradient contribution of operation to the input node and parameters based on the output node derivatives. Each operation will be passed its relevant slice for params and param_derivs Note: all calculations should use += as to not overwrite other operations contributions, and in the case of data shape n>1 the sum of parameter gradients from all individual examples should be accumulated in param_deriv and error the graph will later divide by n to get the mean error and error derivatives.

Provided Methods

Implementors