trying to generalize the constraint of the tensor being order 3