Problem with Graph Neural Network in PyTorch Geometric
I'm trying to understand what is wrong with the following GNN model implemented in PyTorch
class Net(torch.nn.Module):
    def __init__(self):
        super().__init__()
        
        self.conv = SAGEConv(dataset.num_features,
                             dataset.num_classes,
                             aggr=&quot;max&quot;) # max, mean, add ...)
    def forward():
        x = self.conv(data.x, data.edge_index)
        return F.log_softmax(x, dim=1)

but I get the following error when trying to run a training loop:
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
&lt;ipython-input-34-f3ee8050af6a&gt; in &lt;module&gt;
      1 best_val_acc = test_acc = 0
      2 for epoch in range(1,100):
----&gt; 3     train()
      4     _, val_acc, tmp_test_acc = test()
      5     if val_acc &gt; best_val_acc:

&lt;ipython-input-14-64df4e2a24f9&gt; in train()
      2     model.train()
      3     optimizer.zero_grad()
----&gt; 4     F.nll_loss(model()[data.train_mask], data.y[data.train_mask]).backward()
      5     optimizer.step()
      6 

~\anaconda3\lib\site-packages\torch\nn\modules\module.py in _call_impl(self, *input, **kwargs)
   1049         if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
   1050                 or _global_forward_hooks or _global_forward_pre_hooks):
-&gt; 1051             return forward_call(*input, **kwargs)
   1052         # Do not call functions when jit is used
   1053         full_backward_hooks, non_full_backward_hooks = [], []

TypeError: forward() takes 0 positional arguments but 1 was given

I'm adding more details as requested on how I call the model :
def train():
    model.train()
    optimizer.zero_grad()
    F.nll_loss(model()[data.train_mask], data.y[data.train_mask]).backward()
    optimizer.step()

def test():
    model.eval()
    logits, accs = model(), []
    for _, mask in data('train_mask', 'val_mask', 'test_mask'):
        pred = logits[mask].max(1)[1]
        acc = pred.eq(data.y[mask]).sum().item() / mask.sum().item()
        accs.append(acc)
    return accs


Function torch.nn.Module.forward should have at minimum one argument: self. In your case, you have two: self and your input data.
    def forward(self, data): # &lt;-
        x = self.conv(data.x, data.edge_index)
        return F.log_softmax(x, dim=1)

