Replace dimensions with all equal values with singletons.
tensor – input tensor. Must be real
tol – tolerance