Actually, just below that in the if statement there's this:

        eq = i == dims1;

So to maintain the logic that was there, it is important if (dims1 != dims2).  Unless that possible use of 'i' is unintentional in which case this is a subtle bug.

I would probably rewrite that code a bit to make it clearer (even just adding parens around that equality in the assignment and making eq a bool would make it more readable), but I don't know the code well enough.