tltorch.utils.get_tensorized_shape

tltorch.utils.get_tensorized_shape(in_features, out_features, order=None, min_dim=2, verbose=True)[source]

Factorizes in_features and out_features such that: * they both are factorized into the same number of integers * they should both be factorized into order integers * each of the factors should be at least min_dim

This is used to tensorize a matrix of size (in_features, out_features) into a higher order tensor

Parameters:
in_features, out_featuresint
orderint

the number of integers that each input should be factorized into

min_dimint

smallest acceptable integer value for the factors

Returns:
in_tensorized, out_tensorizedtuple[int]

tuples of ints used to tensorize each dimension

Notes

This is a bruteforce solution but is enough for the dimensions we encounter in DNNs