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]

[src]

Get the value of the node.

[src]

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

[src]

Zero the gradients. Must be called after a backward step or whenever inputs change.

[src]

[src]

Return the parameters of the graph.

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

[src]

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

[src]

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

[src]

Clip the value. Useful for clipping losses.

[src]

Square this variable.

[src]

Sum this variable.

[src]

Take the natural logarithm of this variable.

[src]

Take the tanh of this variable.

[src]

Transpose this variable.

[src]

Exponentiate this variable.

[src]

Compute the softmax of this variable.

[src]

Compute the log-softmax of this variable.

[src]

Compute the sigmoid of this variable.

[src]

Compute the ReLU of this variable.

[src]

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

[src]

Compute the matrix multiplication of LHS and RHS.

[src]

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

impl Variable<ParameterNode>
[src]

[src]

Return the (dense) gradient value of this node.

[src]

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]

[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]

[src]

Formats the value using the given formatter. Read more

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

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

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

[src]

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

[src]

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

[src]

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

[src]

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

[src]

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.

[src]

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.

[src]

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.

[src]

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.

[src]

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.

[src]

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.

[src]

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.

[src]

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.

[src]

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.

[src]

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.

[src]

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.

[src]

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.

[src]

Performs the / operation.

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

The resulting type after applying the - operator.

[src]

Performs the unary - operation.

Auto Trait Implementations

impl<T> !Send for Variable<T>

impl<T> !Sync for Variable<T>