pub struct Node<T> { /* private fields */ }Implementations§
Source§impl<T> Node<T>
 
impl<T> Node<T>
Sourcepub fn new(
    node_id: String,
    operation: fn(Vec<Tensor<T>>) -> Tensor<T>,
    operation_prime: fn(&Tensor<T>, Vec<&Tensor<T>>) -> Vec<Tensor<T>>,
    parameter: Vec<Arc<dyn Graph<T>>>,
    calc_dim: fn(Vec<Vec2>) -> Vec2,
) -> Node<T>where
    T: Copy,
 
pub fn new(
    node_id: String,
    operation: fn(Vec<Tensor<T>>) -> Tensor<T>,
    operation_prime: fn(&Tensor<T>, Vec<&Tensor<T>>) -> Vec<Tensor<T>>,
    parameter: Vec<Arc<dyn Graph<T>>>,
    calc_dim: fn(Vec<Vec2>) -> Vec2,
) -> Node<T>where
    T: Copy,
computation node
§Arguments
if this node is z = f(x, y):
- node_id
- operation- f
- operation_train
- operation_prime- f_x,y which takes in a gradient dC/dz and inputs x, y; outputs gradients dC/dx, dC/dy
- parameter- Vec<(x, y)>
pub fn with_dim( node_id: String, operation: fn(Vec<Tensor<T>>) -> Tensor<T>, operation_prime: fn(&Tensor<T>, Vec<&Tensor<T>>) -> Vec<Tensor<T>>, parameter: Vec<Arc<dyn Graph<T>>>, dimension: Vec2, ) -> Node<T>
Trait Implementations§
Source§impl<T> Graph<T> for Node<T>
 
impl<T> Graph<T> for Node<T>
fn get_id(&self) -> String
fn get_dim(&self) -> Vec2
fn run(&self, state: &Context<T>, variable: &Context<T>) -> Tensor<T>
fn forward_pass( &self, state: &Context<T>, variable: &Context<T>, history: &mut Context<T>, ) -> Tensor<T>
fn backward_pass( &self, state: &mut Context<T>, variable: &Context<T>, history: &Context<T>, gradient: &Tensor<T>, learning_rate: T, )
fn train( &self, state: &Context<T>, variable: &Context<T>, history: &mut Context<T>, ) -> Tensor<T>
Auto Trait Implementations§
impl<T> Freeze for Node<T>
impl<T> !RefUnwindSafe for Node<T>
impl<T> !Send for Node<T>
impl<T> !Sync for Node<T>
impl<T> Unpin for Node<T>
impl<T> !UnwindSafe for Node<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more