Added TensorModeRank function