Unknown builtin op: torch_scatter::scatter_max
See original GitHub issueWhen I tried to load TorchScript module from C++, I got the error
terminate called after throwing an instance of 'torch::jit::ErrorReport' what(): Unknown builtin op: torch_scatter::scatter_max. Could not find any similar ops to torch_scatter::scatter_max. This op may not exist or may not be currently supported in TorchScript. : File "/opt/conda/lib/python3.7/site-packages/torch_scatter/scatter.py", line 72
The model is trained using PyTorch 1.5.0 and latest pytorch geometric, and torch scatter 2.0.5, and I converted the trained model to TorchScript. I noted the document from https://pytorch-geometric.readthedocs.io/en/latest/notes/jit.html. But it did not mention how to load the custom operators such as torch_scatter::scatter_max. The serving environment is C++, and that’s a separate environment from the training environment.
How can I resolve this error for TorchScript serving using C++?
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
That’s correct. This information is currently missing in the tutorial. You need to also build the
torch-scatter
C++ API, see here. You can find a complete example of serving a model here.Did you take a look at https://github.com/pyg-team/pytorch_geometric/tree/master/examples/cpp? Does it work for you?