Finding the positional minimum and maximum of a tensor (argmin and argmax)