Checks if two tensors have equal ranks.