tltorch
.CPTensor¶

class
tltorch.
CPTensor
(*args, **kwargs)[source]¶ CP Factorization
 Parameters
 weights
 factors
 shape
 rank
 Attributes
 decomposition
Methods
from_tensor
(tensor[, rank])Create a factorized tensor by decomposing a full tensor
new
(shape, rank, **kwargs)Main way to create a factorized tensor
normal_
([mean, std])Inialize the factors of the factorization such that the reconstruction follows a Gaussian distribution
Reconstruct the full tensor from its factorized form
transduct
(new_dim[, mode, new_factor])Transduction adds a new dimension to the existing factorization
init_from_tensor

classmethod
new
(shape, rank, **kwargs)[source]¶ Main way to create a factorized tensor
 Parameters
 shapetuple[int]
shape of the factorized tensor to create
 rankint, ‘same’ or float
rank of the decomposition
 factorization{‘CP’, ‘TT’, ‘Tucker’}, optional
Tensor factorization to use to decompose the tensor, by default ‘CP’
 Returns
 TensorFactorization
Tensor in Factorized form.
 Raises
 ValueError
If the factorization given does not exist.

classmethod
from_tensor
(tensor, rank='same', **kwargs)[source]¶ Create a factorized tensor by decomposing a full tensor
 Parameters
 tensortorch.tensor
tensor to factorize
 shapetuple[int]
shape of the factorized tensor to create
 rankint, ‘same’ or float
rank of the decomposition
 factorization{‘CP’, ‘TT’, ‘Tucker’}, optional
Tensor factorization to use to decompose the tensor, by default ‘CP’
 Returns
 TensorFactorization
Tensor in Factorized form.
 Raises
 ValueError
If the factorization given does not exist.

normal_
(mean=0, std=1)[source]¶ Inialize the factors of the factorization such that the reconstruction follows a Gaussian distribution
 Parameters
 meanfloat, currently only 0 is supported
 stdfloat
standard deviation
 Returns
 self

transduct
(new_dim, mode=0, new_factor=None)[source]¶ Transduction adds a new dimension to the existing factorization
 Parameters
 new_dimint
dimension of the new mode to add
 modewhere to insert the new dimension, after the channels, default is 0
by default, insert the new dimensions before the existing ones (e.g. add time before height and width)
 Returns
 self