Struct wyrm::Variable[][src]

pub struct Variable<T> where
    T: Node
{ /* fields omitted */ }

Handle to a node in the computation graph. The underlying nodes are reference counted, so the handles can be freely cloned to use the nodes multiple times in the same graph.

Methods

impl<T> Variable<T> where
    T: Node
[src]

Get the value of the node.

Run the forward pass through the subgraph terminating at this node, recursing through the ancestor nodes.

Clear the graph caches. Must be called whenever inputs change and [backward] is not called.

Zero the accumulated gradients for the parameter nodes in this graph.

Return the parameters of the graph.

Mutably return the parameters of the graph.

impl<T> Variable<T> where
    T: Node<Value = Arr, InputGradient = Arr>, 
[src]

Box the variable, erasing its specific type. Use to manage the complexity of variable types in deep computation graphs.

Run the backward pass through the subgraph terminating at this node. The weight parameter scales the gradients.

Clip the value. Useful for clipping losses.

Square this variable.

Sum this variable.

Take the natural logarithm of this variable.

Take the tanh of this variable.

Transpose this variable.

Exponentiate this variable.

Compute the softmax of this variable.

Compute the log-softmax of this variable.

Compute the sigmoid of this variable.

Compute the ReLU of this variable.

Compute the row-wise vector dot product of LHS and RHS.

Compute the matrix multiplication of LHS and RHS.

Stack/concatenate LHS and RHS, either row-wise (ndarray::Axis(0)) or column-wise (ndarray::Axis(1)).

Slice the node according to the ndarray slice syntax.

impl Variable<ParameterNode>
[src]

Return the (dense) gradient value of this node.

Row-wise indexing of this parameter node. Primiarily used to implement embedding layers.

impl<T> Variable<SparseCategoricalCrossentropyNode<T>> where
    T: Node<Value = Arr, InputGradient = Arr>, 
[src]

Return the log-softmax predictions from a sparse categorical cross-entropy node.

Calling .value() on the node returns the value of the loss; this function allows getting the predictins with low overhead.

Trait Implementations

impl<T: Debug> Debug for Variable<T> where
    T: Node
[src]

Formats the value using the given formatter. Read more

impl<T: Node> Clone for Variable<T>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<'value> DataInput<&'value Arr> for Variable<ParameterNode>
[src]

Set the value of this node.

impl<'value> DataInput<&'value Arr> for Variable<InputNode>
[src]

Set the value of this node.

impl DataInput<f32> for Variable<InputNode>
[src]

Set the value of this node.

impl<'value> DataInput<&'value [usize]> for Variable<IndexInputNode>
[src]

Set the value of this node.

impl DataInput<usize> for Variable<IndexInputNode>
[src]

Set the value of this node.

impl<LHS, RHS> Add<Variable<RHS>> for Variable<LHS> where
    RHS: Node<Value = Arr, InputGradient = Arr>,
    LHS: Node<Value = Arr, InputGradient = Arr>, 
[src]

The resulting type after applying the + operator.

Performs the + operation.

impl<LHS> Add<f32> for Variable<LHS> where
    LHS: Node<Value = Arr, InputGradient = Arr>, 
[src]

The constant will be broadcast to have the same shape as the LHS.

The resulting type after applying the + operator.

Performs the + operation.

impl<RHS> Add<Variable<RHS>> for f32 where
    RHS: Node<Value = Arr, InputGradient = Arr>, 
[src]

The constant will be broadcast to have the same shape as the RHS.

The resulting type after applying the + operator.

Performs the + operation.

impl<LHS, RHS> Sub<Variable<RHS>> for Variable<LHS> where
    RHS: Node<Value = Arr, InputGradient = Arr>,
    LHS: Node<Value = Arr, InputGradient = Arr>, 
[src]

The resulting type after applying the - operator.

Performs the - operation.

impl<LHS> Sub<f32> for Variable<LHS> where
    LHS: Node<Value = Arr, InputGradient = Arr>, 
[src]

The constant will be broadcast to have the same shape as the LHS.

The resulting type after applying the - operator.

Performs the - operation.

impl<RHS> Sub<Variable<RHS>> for f32 where
    RHS: Node<Value = Arr, InputGradient = Arr>, 
[src]

The constant will be broadcast to have the same shape as the RHS.

The resulting type after applying the - operator.

Performs the - operation.

impl<LHS, RHS> Mul<Variable<RHS>> for Variable<LHS> where
    RHS: Node<Value = Arr, InputGradient = Arr>,
    LHS: Node<Value = Arr, InputGradient = Arr>, 
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl<LHS> Mul<f32> for Variable<LHS> where
    LHS: Node<Value = Arr, InputGradient = Arr>, 
[src]

The constant will be broadcast to have the same shape as the LHS.

The resulting type after applying the * operator.

Performs the * operation.

impl<RHS> Mul<Variable<RHS>> for f32 where
    RHS: Node<Value = Arr, InputGradient = Arr>, 
[src]

The constant will be broadcast to have the same shape as the RHS.

The resulting type after applying the * operator.

Performs the * operation.

impl<LHS, RHS> Div<Variable<RHS>> for Variable<LHS> where
    RHS: Node<Value = Arr, InputGradient = Arr>,
    LHS: Node<Value = Arr, InputGradient = Arr>, 
[src]

The resulting type after applying the / operator.

Performs the / operation.

impl<LHS> Div<f32> for Variable<LHS> where
    LHS: Node<Value = Arr, InputGradient = Arr>, 
[src]

The constant will be broadcast to have the same shape as the LHS.

The resulting type after applying the / operator.

Performs the / operation.

impl<RHS> Div<Variable<RHS>> for f32 where
    RHS: Node<Value = Arr, InputGradient = Arr>, 
[src]

The constant will be broadcast to have the same shape as the RHS.

The resulting type after applying the / operator.

Performs the / operation.

impl<T> Neg for Variable<T> where
    T: Node<Value = Arr, InputGradient = Arr>, 
[src]

The resulting type after applying the - operator.

Performs the unary - operation.

Auto Trait Implementations

impl<T> !Send for Variable<T>

impl<T> !Sync for Variable<T>