tltorch
.BlockTT
- class tltorch.BlockTT(*args, **kwargs)[source]
- Attributes
decomposition
Returns the factors and parameters composing the tensor in factorized form
Methods
from_tensor
(tensor, tensorized_shape, rank, ...)Create a factorized tensor by decomposing a full tensor
new
(tensorized_shape, rank[, device, dtype])Main way to create a Tensorized Matrix
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
init_from_tensor
- classmethod new(tensorized_shape, rank, device=None, dtype=None, **kwargs)[source]
Main way to create a Tensorized Matrix
- Parameters
- tensorized_shapetuple[int]
- rankint, ‘same’ or float
rank of the decomposition
- n_matricestuple or int, default is ()
if not (), indicates how many matrices have to be jointly factorized
- factorization{‘CP’, ‘TT’, ‘Tucker’}, optional
Tensor factorization to use to decompose the tensor, by default ‘CP’
- Returns
- TensorizedTensor
Tensor in Tensorized and Factorized form.
- Raises
- ValueError
If the factorization given does not exist.
- property decomposition
Returns the factors and parameters composing the tensor in factorized form
- to_tensor()[source]
Reconstruct the full tensor from its factorized form
- 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
- classmethod from_tensor(tensor, tensorized_shape, rank, **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.