Variabl
The Variabl case class represents a tensor with automatic differentiation capability. It tracks operations applied to it for backward gradient propagation. Variabls can be combined using arithmetic operations, activation functions, and loss functions. Backpropagation is triggered via the backward method.
Value parameters
- data
-
the tensor data for this variable.
- gradFn
-
an optional function for backpropagation.
- name
-
an optional name for this variable.
- ops
-
the implicit autograd operations for tensor computations.
Attributes
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Members list
Value members
Concrete methods
Multiplies this variable with another variable element-wise.
Multiplies this variable with another variable element-wise.
Value parameters
- other
-
the variable to multiply.
Attributes
- Returns
-
a new Variabl representing the multiplication.
Multiplies this variable by a constant.
Multiplies this variable by a constant.
Value parameters
- s
-
the constant multiplier.
Attributes
- Returns
-
a new Variabl representing the scaled variable.
Adds this variable with another variable.
Adds this variable with another variable.
Value parameters
- other
-
the variable to add.
Attributes
- Returns
-
a new Variabl representing the element-wise addition.
Adds a constant to this variable.
Adds a constant to this variable.
Value parameters
- s
-
the constant to add.
Attributes
- Returns
-
a new Variabl representing the result.
Subtracts another variable from this variable.
Subtracts another variable from this variable.
Value parameters
- other
-
the variable to subtract.
Attributes
- Returns
-
a new Variabl representing the element-wise subtraction.
Subtracts a constant from this variable.
Subtracts a constant from this variable.
Value parameters
- s
-
the constant to subtract.
Attributes
- Returns
-
a new Variabl representing the result.
Divides this variable by another variable element-wise.
Divides this variable by another variable element-wise.
Value parameters
- other
-
the variable divisor.
Attributes
- Returns
-
a new Variabl representing the division.
Divides this variable by a constant.
Divides this variable by a constant.
Value parameters
- s
-
the constant divisor.
Attributes
- Returns
-
a new Variabl representing the scaled division.
Slice this tensor variable along its three dimensions. Allows slicing using either Range objects or the special character '?' to denote selecting the entire dimension (as in x(?, 2, 5 until 10)).
Slice this tensor variable along its three dimensions. Allows slicing using either Range objects or the special character '?' to denote selecting the entire dimension (as in x(?, 2, 5 until 10)).
Value parameters
- a
-
the slice for dimension 0 (a
Rangeor'?') - b
-
the slice for dimension 1 (a
Rangeor'?') - c
-
the slice for dimension 2 (a
Rangeor'?')
Attributes
- Returns
-
a new
Variablrepresenting the sliced view - Throws
-
IllegalArgumentException
if any slice argument is not a
Rangeor'?'
Performs backpropagation with a default gradient of ones.
Performs backpropagation with a default gradient of ones.
Attributes
Performs backpropagation using the specified output gradient.
Performs backpropagation using the specified output gradient.
Value parameters
- gradOutput
-
the gradient tensor to propagate.
Attributes
Performs batched matrix multiplication of this variable with another variable.
Performs batched matrix multiplication of this variable with another variable.
Value parameters
- other
-
the variable to multiply in batches.
Attributes
- Returns
-
a Variabl representing the batch matrix multiplication.
Detaches the variable from the computation graph, returning a new variable with the same data.
Detaches the variable from the computation graph, returning a new variable with the same data.
Value parameters
- name
-
an optional new name for the detached variable.
Attributes
- Returns
-
a new variable with identical data but no gradient function.
Computes the dot product of this variable with another variable.
Computes the dot product of this variable with another variable.
Value parameters
- other
-
the variable to perform the dot product with.
Attributes
- Returns
-
a Variabl representing the dot product.
Applies the ELU activation function to this variable.
Applies the ELU activation function to this variable.
Value parameters
- alpha
-
the ELU scaling parameter (default is 1.0).
Attributes
- Returns
-
a Variabl after applying ELU.
Returns a new variable with data filled with the specified value and the same shape as this variable.
Returns a new variable with data filled with the specified value and the same shape as this variable.
Value parameters
- value
-
the value to fill the new variable with.
Attributes
- Returns
-
a Variabl with the specified value.
Applies the GeLU activation function to this variable.
Applies the GeLU activation function to this variable.
Attributes
- Returns
-
a Variabl after applying GeLU.
Applies the LeakyReLU activation function to this variable.
Applies the LeakyReLU activation function to this variable.
Value parameters
- alpha
-
the slope for negative inputs (default is 0.2).
Attributes
- Returns
-
a Variabl after applying LeakyReLU.
Performs matrix multiplication of this variable with another variable.
Performs matrix multiplication of this variable with another variable.
Value parameters
- other
-
the variable to multiply matrices with.
Attributes
- Returns
-
a Variabl representing the matrix multiplication result.
Returns a new variable with data filled with ones and the same shape as this variable.
Returns a new variable with data filled with ones and the same shape as this variable.
Attributes
- Returns
-
a Variabl with ones.
Applies the ReLU activation function to this variable.
Applies the ReLU activation function to this variable.
Attributes
- Returns
-
a Variabl after applying ReLU.
Returns the shape of the tensor data as a list of dimensions.
Returns the shape of the tensor data as a list of dimensions.
Attributes
- Returns
-
a List [Int] representing the dimensions of the data.
Applies the sigmoid activation function to this variable.
Applies the sigmoid activation function to this variable.
Attributes
- Returns
-
a Variabl after applying sigmoid.
Applies the softmax activation function to this variable.
Applies the softmax activation function to this variable.
Attributes
- Returns
-
a Variabl after applying softmax.
Computes the sum of elements along the specified axis and returns the result as a new variable.
Computes the sum of elements along the specified axis and returns the result as a new variable.
Value parameters
- axis
-
the axis along which to compute the sum.
Attributes
- Returns
-
a Variabl representing the sum along the axis.
Applies the tanh activation function to this variable.
Applies the tanh activation function to this variable.
Attributes
- Returns
-
a Variabl after applying tanh.
Returns a string representation of the variable. If a name is defined, it is included in the output.
Returns a string representation of the variable. If a name is defined, it is included in the output.
Attributes
- Returns
-
a string containing the name (if available) and data.
- Definition Classes
-
Any
Returns a new variable with data filled with zeros and the same shape as this variable.
Returns a new variable with data filled with zeros and the same shape as this variable.
Attributes
- Returns
-
a Variabl with zeros.
Chains the provided function with this variable.
Chains the provided function with this variable.
Value parameters
- f
-
a function that takes a Variabl and returns a Variabl.
Attributes
- Returns
-
the result of applying the function to this variable.
Inherited methods
An iterator over the names of all the elements of this product.
An iterator over the names of all the elements of this product.
Attributes
- Inherited from:
- Product
An iterator over all the elements of this product.
An iterator over all the elements of this product.
Attributes
- Returns
-
in the default implementation, an
Iterator[Any] - Inherited from:
- Product