tltorch.CPTensorized

class tltorch.CPTensorized(*args, **kwargs)[source]

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

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.

classmethod from_tensor(tensor, tensorized_shape, 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.