tltorch.tensor_hooks
.tensor_dropout
- tltorch.tensor_hooks.tensor_dropout(factorized_tensor, p=0, min_dim=3, min_values=1, drop_test=False)[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
- min_dimint, default is 3
only apply dropout to modes with dimension larger than min_dim
- min_valuesint, default is 1
minimum number of components to select
- 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)