[ONNX] Compare types for DeviceObjType instead of strings (#78114)
- Turn all string comparison on node types into `isinstance` checks
- Update error message in the device op to include the unexpected type's name: `RuntimeError: Unsupported: ONNX export of operator prim::device, output type should be 'DeviceObjType', not '<some unknown type>'. Please feel free to request support or submit a pull request on PyTorch GitHub.`
Tested:
Unit test in `test/onnx/test_pytorch_onnx_onnxruntime.py::TestONNXRuntime_opset13::test_to_device`
Follow up of #78085
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78114
Approved by: https://github.com/garymm