You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to run the MNIST example, but running into the following error. Any insights?
`---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in
82
83 for epoch in range(1, 20):
---> 84 loss = train(epoch)
85 train_acc = test(train_loader)
86 test_acc = test(test_loader)
in train(epoch)
59 # data = rotation_2(data)
60 print(data.edge_index)
---> 61 output = model(data)
62 loss = F.nll_loss(output, data.y)
63 loss.backward()
/opt/tljh/user/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
530 result = self._slow_forward(*input, **kwargs)
531 else:
--> 532 result = self.forward(*input, **kwargs)
533 for hook in self._forward_hooks.values():
534 hook_result = hook(self, input, result)
in forward(self, data)
24 def forward(self, data):
25 for i in range(self.layers_num):
---> 26 data.x = self.conv_layers[i](data.x, data.pos, data.edge_index)
27
28 if self.use_cluster_pooling:
/opt/tljh/user/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
530 result = self._slow_forward(*input, **kwargs)
531 else:
--> 532 result = self.forward(*input, **kwargs)
533 for hook in self._forward_hooks.values():
534 hook_result = hook(self, input, result)
Hi
I ran into the same problem these days and finally discover that the function add_self_loops in graph_conv.py, line 28, returns two arguments and you need the first one, so modify the call with: edge_index, _ = add_self_loops(edge_index, num_nodes=x.size(0))
Hello!
I'm trying to run the MNIST example, but running into the following error. Any insights?
`---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in
82
83 for epoch in range(1, 20):
---> 84 loss = train(epoch)
85 train_acc = test(train_loader)
86 test_acc = test(test_loader)
in train(epoch)
59 # data = rotation_2(data)
60 print(data.edge_index)
---> 61 output = model(data)
62 loss = F.nll_loss(output, data.y)
63 loss.backward()
/opt/tljh/user/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
530 result = self._slow_forward(*input, **kwargs)
531 else:
--> 532 result = self.forward(*input, **kwargs)
533 for hook in self._forward_hooks.values():
534 hook_result = hook(self, input, result)
in forward(self, data)
24 def forward(self, data):
25 for i in range(self.layers_num):
---> 26 data.x = self.conv_layers[i](data.x, data.pos, data.edge_index)
27
28 if self.use_cluster_pooling:
/opt/tljh/user/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
530 result = self._slow_forward(*input, **kwargs)
531 else:
--> 532 result = self.forward(*input, **kwargs)
533 for hook in self._forward_hooks.values():
534 hook_result = hook(self, input, result)
in forward(self, x, pos, edge_index)
22 edge_index = add_self_loops(edge_index, num_nodes=x.size(0)) # num_edges = num_edges + num_nodes
23
---> 24 return self.propagate(edge_index=edge_index, x=x, pos=pos, aggr='add') # [N, out_channels, label_dim]
25
26 def message(self, pos_i, pos_j, x_j):
~/.local/lib/python3.6/site-packages/torch_geometric/nn/conv/message_passing.py in propagate(self, edge_index, size, **kwargs)
165 assert len(size) == 2
166
--> 167 kwargs = self.collect(edge_index, size, kwargs)
168
169 msg_kwargs = self.distribute(self.msg_params, kwargs)
~/.local/lib/python3.6/site-packages/torch_geometric/nn/conv/message_passing.py in collect(self, edge_index, size, kwargs)
113
114 self.set_size(size, idx, data)
--> 115 out[arg] = data.index_select(self.node_dim, edge_index[idx])
116
117 size[0] = size[1] if size[0] is None else size[0]
TypeError: index_select() received an invalid combination of arguments - got (int, NoneType), but expected one of:
didn't match because some of the arguments have invalid types: (!int!, !NoneType!)
didn't match because some of the arguments have invalid types: (int, !NoneType!)`
The text was updated successfully, but these errors were encountered: