tltorch.tensor_hooks.tensor_dropout

tltorch.tensor_hooks.tensor_dropout(factorized_tensor, p=0)[source]

Tensor Dropout

Parameters
factorized_tensorFactorizedTensor

the tensor module parametrized by the tensor decomposition to which to apply tensor dropout

pfloat

dropout probability if 0, no dropout is applied if 1, all the components but 1 are dropped in the latent space

Returns
FactorizedTensor

the module to which tensor dropout has been attached

Examples

>>> tensor = FactorizedTensor.new((3, 4, 2), rank=0.5, factorization='CP').normal_()
>>> tensor = tensor_dropout(tensor, p=0.5)
>>> remove_tensor_dropout(tensor)