xxlya/BrainGNN_Pytorch

Errors in MyNNConv

zhiye9 opened this issue · 2 comments

Hello, this is excellent work. it is a very inspiring method to use GNN on fmri data. But I have a few questions regarding part of the code and the network:

Lines 34 to 43 in class MyNNConv:

    def forward(self, x, edge_index, edge_weight=None, pseudo= None, size=None):
        """"""
        edge_weight = edge_weight.squeeze()
        if size is None and torch.is_tensor(x):
            edge_index, edge_weight = add_remaining_self_loops(
                edge_index, edge_weight, 1, x.size(0))

        weight = self.nn(pseudo).view(-1, self.in_channels, self.out_channels)
        if torch.is_tensor(x):
            x = torch.matmul(x.unsqueeze(1), weight).squeeze(1)

What is the weight computed at line 41? Because your input of self.nn (self.n1 = nn.Sequential(nn.Linear(self.R, self.k, bias=False), nn.ReLU(), nn.Linear(self.k, self.dim1 * self.indim))) is just pseudo = None.

So I got an error:

TypeError: linear(): argument 'input' (position 1) must be Tensor, not NoneType

Thank you in advance for your kind help.

Meanwhile, may I ask what is data.pos in your dataset?

xb-li commented

Hello,I encountered some issues while running file 03-main.py, as shown below:
Traceback (most recent call last):
File "03-main.py", line 203, in
tr_loss, s1_arr, s2_arr, w1, w2 = train(epoch)
File "03-main.py", line 130, in train
output, w1, w2, s1, s2 = model(data.x, data.edge_index, data.batch, data.edge_attr, data.pos)
File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/root/autodl-tmp/BrainGNN/net/braingnn.py", line 63, in forward
x = self.conv2(x, edge_index, edge_attr, pos)
File "/root/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/root/autodl-tmp/BrainGNN/net/braingraphconv.py", line 55, in forward
return self.propagate(edge_index, size=size, x=x,
File "/root/autodl-tmp/BrainGNN/net/brainmsgpassing.py", line 126, in propagate
out = self.message(*message_args)
File "/root/autodl-tmp/BrainGNN/net/braingraphconv.py", line 59, in message
edge_weight = softmax(edge_weight, edge_index_i, ptr, size_i)
RuntimeError: nvrtc: error: invalid value for --gpu-architecture (-arch)

nvrtc compilation failed:

I hope to receive some help.