Fix binary bitwise converter for when lhs is scalar (#72101)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72101
When lhs is scalar, and rhs has shape [1,], then currently the assert will fail because lhs shape has fewer dimensions than rhs shape.
This happens when using implicit batch dimension, when we removed the 1st dimensino from input tensor, causing it to have shape [].
Fix it by reducing the rhs constant with a squeeze_left, so it becomes a scalar too. More generally, we squeeze_left on input if it's
a constant tensor. This is safe because broadcast will pad dimensions on the left (prepend) to make lhs and rhs shape compatible.
However this is not a complete fix - it doesn't fix the case when one of the operand is scalar int/float literal, and when the other is a scalar tensor. This will require a further fix.
Reviewed By: 842974287
Differential Revision: D33909485
fbshipit-source-id: c6ab9f3a53bd2904107bd7ee829dfdb539ea0608
(cherry picked from commit f7c2ff925ae523b9c9cc301a3dec44269e034b03)