Torchscript error - Module 'GCNConv' has no attribute 'inspector'

Hi, I am writing here because when trying to export my model and save it using torchscript, the following error appears and I was not able to find any solution on the web.

RuntimeError: Module ‘GCNConv’ has no attribute ‘inspector’ (This attribute exists on the Python module, but we failed to convert Python type: ‘torch_geometric.nn.conv.utils.inspector.Inspector’ to a TorchScript type. Only tensors and (possibly nested) tuples of tensors, lists, or dictsare supported as inputs or outputs of traced functions, but instead got value of type Inspector. Its type was inferred; try adding a type annotation for the attribute.):

File "/Users/---/miniconda3/envs/---/lib/python3.7/site-packages/torch_geometric/nn/conv/", line 534
        self._explain = explain
        self.inspector.inspect(self.explain_message, pop_first=True)
        ~~~~~~~~~~~~~~ <--- HERE
        self.__user_args__ = self.inspector.keys(methods).difference(

The model I am trying to export is the one provided by Open Graph Benchmark (OGB) for graph prediction. It can be fount at the following link: ogb/examples/graphproppred/mol at master · snap-stanford/ogb · GitHub

I am new to PyTorch, thank you in advance for your help.

1 Like