The TensorD companion object provides factory methods for the TensorD class.
Attributes
Members list
Value members
Concrete methods
Build a tensor from the scaler argument list x.
Build a tensor from the scaler argument list x.
Value parameters
- n1
-
the first dimension
- n2
-
the second dimension
- n3
-
the third dimension
- x
-
the list/vararg of scacollection.immutable.IndexedSeq [MatrixD]lars
Attributes
Build a tensor from the vector argument list x.
Build a tensor from the vector argument list x.
Value parameters
- n
-
the first dimension
- vs
-
the list/vararg of vectors
Attributes
Build a tensor from the vector argument list x.
Build a tensor from the vector argument list x.
Value parameters
- n
-
the first dimension
- vs
-
the indexed sequence of vectors
Attributes
Build a tensor from the vector argument list x.
Build a tensor from the vector argument list x.
Value parameters
- n
-
the first dimension
- vs
-
the indexed sequence of vectors
Attributes
Create a tensor from a variable argument list of matrices (row-wise). Use transpose to make it column-wise.
Create a tensor from a variable argument list of matrices (row-wise). Use transpose to make it column-wise.
Value parameters
- vs
-
the vararg list of matrices
Attributes
Create a tensor from an mutable IndexedSeq of matrices (row-wise). Use transpose to make it column-wise.
Create a tensor from an mutable IndexedSeq of matrices (row-wise). Use transpose to make it column-wise.
Value parameters
- vs
-
the indexed sequence of matrices
Attributes
Create a tensor from an immutable IndexedSeq of matrices (row-wise), as produce by for yield. Use transpose to make it column-wise.
Create a tensor from an immutable IndexedSeq of matrices (row-wise), as produce by for yield. Use transpose to make it column-wise.
Value parameters
- vs
-
the indexed sequence of matrices
Attributes
Broadcast a MatrixD into a 3D tensor (TensorD) in batch‑first layout.
Broadcast a MatrixD into a 3D tensor (TensorD) in batch‑first layout.
- Base tensor is created with batch=1, rows=m.dim, cols=m.dim2
- We explicitly fill base(0,i,j) = m(i,j) so there’s n
- If you request a larger batch, we replicate that slice across batch
Attributes
Compute the broadcasted shape for two 3D shapes aShape and bShape.
Compute the broadcasted shape for two 3D shapes aShape and bShape.
- If one dimension is 1 and the other is R, pick R.
- If both are the same, pick that value.
- Otherwise, throw an error for mismatched dimensions.
Attributes
Expand a TensorD 'src' to 'newShape' if needed. If src.shape == newShape, just return src. Otherwise replicate data along any dimension that was 1 in src.shape but is >1 in newShape.
Expand a TensorD 'src' to 'newShape' if needed. If src.shape == newShape, just return src. Otherwise replicate data along any dimension that was 1 in src.shape but is >1 in newShape.
Attributes
Broadcast a VectorD into a 3D tensor (TensorD), allowing partial broadcasting. The default shape is determined by the axis parameter:
Broadcast a VectorD into a 3D tensor (TensorD), allowing partial broadcasting. The default shape is determined by the axis parameter:
- If axis == 0, the default is a column vector: (v.dim, 1, 1)
- If axis == 1, the default is a row vector: (1, v.dim, 1)
- If axis == 2, the default is a sheet vector: (1, 1, v.dim) If a shape is provided, a base tensor is created with the default shape and then expanded to the given shape using
broadcastTo.
Attributes
Concatenate a sequence of 3D tensors along the specified axis (0, 1, or 2).
Concatenate a sequence of 3D tensors along the specified axis (0, 1, or 2).
Value parameters
- axis
-
dimension along which to concatenate (0, 1, or 2)
- xs
-
sequence of TensorD to concatenate
Attributes
Create a tensor of dimensions dim by dim2 by dim3 where all elements equal to the given value.
Create a tensor of dimensions dim by dim2 by dim3 where all elements equal to the given value.
Value parameters
- dim
-
the row dimension
- dim2
-
the sheet dimension
- value
-
the given value to assign to all elements
Attributes
Create a TensorD from a MatrixD with default shape (1, rows, cols).
Create a TensorD from a MatrixD with default shape (1, rows, cols).
Value parameters
- m
-
the matrix to convert
Attributes
- Returns
-
A TensorD of shape (1, rows, cols)
Create a TensorD from a VectorD with default shape (length, 1, 1).
Create a TensorD from a VectorD with default shape (length, 1, 1).
Value parameters
- v
-
the vector to convert
Attributes
- Returns
-
A TensorD of shape (length, 1, 1)
Create a new tensor filled with ones, based on the given dimensions tuple.
Create a new tensor filled with ones, based on the given dimensions tuple.
Value parameters
- dims
-
a tuple representing the shape of the tensor (dim, dim2, dim3).
Attributes
- Returns
-
a new tensor filled with ones.
Create a new tensor filled with ones, having the same dimensions as the given tensor.
Create a new tensor filled with ones, having the same dimensions as the given tensor.
Value parameters
- tensor
-
the tensor to mimic in dimensions.
Attributes
- Returns
-
a new tensor filled with ones.
Sum all elements of the tensor along the specified axis.
Sum all elements of the tensor along the specified axis.
Value parameters
- axis
-
the axis along which to sum (0 = rows, 1 = columns, 2 = sheets).
- tensor
-
the tensor to sum over.
Attributes
- Returns
-
A new TensorD with the reduced dimension.
Create a new tensor filled with zeros, having the same dimensions as the given tensor.
Create a new tensor filled with zeros, having the same dimensions as the given tensor.
Value parameters
- tensor
-
the tensor to mimic in dimensions.
Attributes
- Returns
-
A new tensor filled with zeros.