tensor#
- swordfish.function.tensor()#
Generate a tensor from X with the following rules:
X
Output
scalar
1D tensor
vector
1D tensor
columnar tuple
2D tensor
matrix
2D tensor
table (with all columns of the same type)
2D tensor
tuple of vectors (each element is a vector of the same type)
2D tensor
tuple of matrices (each element is a matrix with the same dimensions and type)
3D tensor
tuple of tuples (each element is a tuple, and each element of the sub-tuples is a vector of the same type)
3D tensor
n-level nested tuple
n-D tensor (where n <= 10)
Note
Tensors are mainly used with the DolphinDB plugins (such as LibTorch) for data exchange with deep learning frameworks. DolphinDB does not currently support direct storage and computation of tensors, nor direct access or modification to their elements.
- Parameters:
X (Constant) – A scalar, vector, tuple, columnar tuple, matrix or table. These data types are supported: BOOL, CHAR, SHORT, INT, LONG, FLOAT, DOUBLE