Fix Use obj1.is(obj2) warnings (#85688)
Fixes:
```
# define PYBIND11_DEPRECATED(reason) [[deprecated(reason)]]
^
/dev/shm/rbarnes/tempfs/pytorch/torch/csrc/autograd/python_variable.cpp:2603:11: warning: 'operator==' is deprecated: Use obj1.is(obj2) instead [-Wdeprecated-declarations]
if (out == Py_None) {
^
/dev/shm/rbarnes/tempfs/pytorch/cmake/../third_party/pybind11/include/pybind11/detail/../pytypes.h:276:5: note: 'operator==' has been explicitly marked deprecated here
PYBIND11_DEPRECATED("Use obj1.is(obj2) instead")
^
/dev/shm/rbarnes/tempfs/pytorch/cmake/../third_party/pybind11/include/pybind11/detail/common.h:136:43: note: expanded from macro 'PYBIND11_DEPRECATED'
# define PYBIND11_DEPRECATED(reason) [[deprecated(reason)]]
^
/dev/shm/rbarnes/tempfs/pytorch/torch/csrc/autograd/python_variable.cpp:2627:11: warning: 'operator==' is deprecated: Use obj1.is(obj2) instead [-Wdeprecated-declarations]
if (out == Py_None) {
^
/dev/shm/rbarnes/tempfs/pytorch/cmake/../third_party/pybind11/include/pybind11/detail/../pytypes.h:276:5: note: 'operator==' has been explicitly marked deprecated here
PYBIND11_DEPRECATED("Use obj1.is(obj2) instead")
^
/dev/shm/rbarnes/tempfs/pytorch/cmake/../third_party/pybind11/include/pybind11/detail/common.h:136:43: note: expanded from macro 'PYBIND11_DEPRECATED'
# define PYBIND11_DEPRECATED(reason) [[deprecated(reason)]]
^
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/85688
Approved by: https://github.com/albanD, https://github.com/ezyang