tensorly.ndim

ndim(tensor)

Return the number of dimensions of a tensor