Fix test_binary_ufuncs.py for Python 3.10
This is a partial fix for https://github.com/pytorch/pytorch/issues/66424
Before this PR, test_binary_ufuncs.py gives DeprecationWarning in Python 3.8 and "TypeError: 'float' object cannot be interpreted as an integer" in Python 3.10.
With this PR, `python run_test.py -i test_binary_ufuncs.py` succeeds with Python 3.10.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/74013
Approved by: https://github.com/ezyang