Struct ktensor::Node
[−]
[src]
pub struct Node<T> { /* fields omitted */ }
Methods
impl<T> Node<T>
[src]
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<Graph<T>>>,
calc_dim: fn(_: Vec<Vec2>) -> Vec2
) -> Node<T> where
T: Copy,
node_id: String,
operation: fn(_: Vec<Tensor<T>>) -> Tensor<T>,
operation_prime: fn(_: &Tensor<T>, _: Vec<&Tensor<T>>) -> Vec<Tensor<T>>,
parameter: Vec<Arc<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
- foperation_train
operation_prime
- f_x,y which takes in a gradient dC/dz and inputs x, y; outputs gradients dC/dx, dC/dyparameter
- Vec<(x, y)>
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<Graph<T>>>,
dimension: Vec2
) -> Node<T>
node_id: String,
operation: fn(_: Vec<Tensor<T>>) -> Tensor<T>,
operation_prime: fn(_: &Tensor<T>, _: Vec<&Tensor<T>>) -> Vec<Tensor<T>>,
parameter: Vec<Arc<Graph<T>>>,
dimension: Vec2
) -> Node<T>
Trait Implementations
impl<T> Graph<T> for Node<T> where
T: Copy + Mul<Output = T> + Add<Output = T>,
[src]
T: Copy + Mul<Output = T> + Add<Output = 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>
&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
)
&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>
&self,
state: &Context<T>,
variable: &Context<T>,
history: &mut Context<T>
) -> Tensor<T>