API reference

tltorch: Tensorized Deep Neural Networks

Tensor Regression Layers

TuckerTRL(input_shape, output_shape, rank[, …]) Tensor Regression Layer with Tucker weights [Rd83a5f2390c0-1]
CPTRL(input_shape, output_shape, rank[, …]) Tensor Regression Layer with CP weights [Rbacc2ed11ff5-1], [Rbacc2ed11ff5-2]
TensorTrainTRL(input_shape, output_shape, rank) Tensor Regression Layer with Tensor-Train weights [Ra045891b45b0-1], [Ra045891b45b0-2]

Tensor Contraction Layers

TCL(input_shape, rank[, verbose, bias]) Tensor Contraction Layer [R66a7d0bed82d-1]

Factorized Linear Layers

TTLinear(in_features, out_features, …[, bias]) Tensorized Fully-Connected Layers
TTMLinear(in_features, out_features, …[, …]) Tensorized Fully-Connected Layers in the TT-Matrix format [R34bd7c4440a9-1]
CPLinear(in_features, out_features, …[, bias]) Tensorized Fully-Connected Layers
TuckerLinear(in_features, out_features, …) Tensorized Fully-Connected Layers

Factorized Convolutions

tltorch.factorized_conv: General N-Dimensional convolutions in Factorized forms

TuckerConv(*args, **kwargs) Create a convolution of arbitrary order with a Tucker kernel
CPConv(*args, **kwargs) Create a Factorized CP convolution of arbitrary order.
TTConv(*args, **kwargs) Create a convolution of arbitrary order with a Tucker kernel.

Tensor Dropout

Tensor Dropout for TensorModules

Classes

Unless you have a particular use for the classes, you should use the convenient functions provided instead.

TuckerDropout(proba[, min_dim]) Decomposition Hook for Tensor Dropout on Tucker tensors
CPDropout(proba[, min_dim]) Decomposition Hook for Tensor Dropout on Tucker tensors
TTDropout(proba[, min_dim]) Decomposition Hook for Tensor Dropout on Tucker tensors

Functions

Convenience functions to easily add or remove tensor dropout from tensor layers.

tucker_dropout(module, p) Tucker Dropout
cp_dropout(module, p) CP Dropout
tt_dropout(module, p) TT Dropout
remove_tucker_dropout(module) Removes the tensor dropout from a TensorModule
remove_cp_dropout(module) Removes the tensor dropout from a TensorModule
remove_tt_dropout(module) Removes the tensor dropout from a TensorModule

L1 Regularization

L1 Regularization on tensor modules.

TuckerL1Regularizer([penalty, …]) Decomposition Hook for Tensor Lasso on Tucker tensors
CPL1Regularizer([penalty, clamp_weights, …]) Decomposition Hook for Tensor Lasso on TT tensors
TTL1Regularizer([penalty, clamp_weights, …]) Decomposition Hook for Tensor Lasso on TT tensors

Initialization

Module for initializing tensor decompositions

cp_init(weights, factors[, std]) Initializes directly the weights and factors of a CP decomposition so the reconstruction has the specified std and 0 mean
tucker_init(core, factors[, std]) Initializes directly the weights and factors of a Tucker decomposition so the reconstruction has the specified std and 0 mean
tt_init(factors[, std]) Initializes directly the weights and factors of a TT decomposition so the reconstruction has the specified std and 0 mean

Internal

TensorModule(*args, **kwargs) A PyTorch module augmented for tensor parametrization