pythonpytorch-geometric

`torch_geometric.nn.attention` not found in PyTorch Geometric Reference


I was following an tutorial in the PyG repository, GraphGPS.

In the example there is a line:

from torch_geometric.nn.attention import PerformerAttention

Which caused an error:

Cannot find reference 'attention' in '__init__.py'

I browsed PyG's documentation again, on the left in package reference, I couldn't find torch_geometric.nn.attention:

enter image description here

How to resolve this problem? I have PyG 2.3.1 installed, and I had no issue running other layers like GCN. Do I need install additional packages?


Solution

  • You need 2.4.0 to use PerformerAttention. Updating your PyG version should resolve your issue. To update the package, run:

    pip install -U torch-geometric