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
Now that I have the input in the right place, I manage to run Step 0 and 1 successfully.
Now, in the Step 2 - SoftTCNLearning_Supervised.py when running this line : model = Net(dataset.num_features, dataset.num_classes).to(device)
I get :
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
Cell In[57], line 2
1 device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
----> 2 model = Net(dataset.num_features, dataset.num_classes).to(device) #Initialize model for each fold.
3 optimizer = torch.optim.Adam(model.parameters(), lr=LearningRate)
5 FoldFolderName = TimeFolderName + "/Fold" + str(num_fold)
File ~/anaconda3/envs/CytoCommunity/lib/python3.10/site-packages/torch_geometric/data/dataset.py:114, in Dataset.num_features(self)
110 @property
111 def num_features(self) -> int:
112 r"""Returns the number of features per node in the dataset.
113 Alias for :py:attr:`~num_node_features`."""
--> 114 return self.num_node_features
File ~/anaconda3/envs/CytoCommunity/lib/python3.10/site-packages/torch_geometric/data/dataset.py:103, in Dataset.num_node_features(self)
100 @property
101 def num_node_features(self) -> int:
102 r"""Returns the number of features per node in the dataset."""
--> 103 data = self[0]
104 data = data[0] if isinstance(data, tuple) else data
105 if hasattr(data, 'num_node_features'):
File ~/anaconda3/envs/CytoCommunity/lib/python3.10/site-packages/torch_geometric/data/dataset.py:198, in Dataset.__getitem__(self, idx)
193 if (isinstance(idx, (int, np.integer))
194 or (isinstance(idx, Tensor) and idx.dim() == 0)
195 or (isinstance(idx, np.ndarray) and np.isscalar(idx))):
197 data = self.get(self.indices()[idx])
--> 198 data = data if self.transform is None else self.transform(data)
199 return data
201 else:
File ~/anaconda3/envs/CytoCommunity/lib/python3.10/site-packages/torch_geometric/transforms/to_dense.py:51, in ToDense.__call__(self, data)
48 size = [num_nodes - data.pos.size(0)] + list(data.pos.size())[1:]
49 data.pos = torch.cat([data.pos, data.pos.new_zeros(size)], dim=0)
---> 51 if data.y is not None and (data.y.size(0) == orig_num_nodes):
52 size = [num_nodes - data.y.size(0)] + list(data.y.size())[1:]
53 data.y = torch.cat([data.y, data.y.new_zeros(size)], dim=0)
IndexError: dimension specified as 0 but tensor has no dimensions
It seems that accessing any of the attributes: dataset.num_classes, dataset.num_features, dataset.num_node_features or dataset.num_edge_features produces the same error and it seems to be related to accessing data.y.size(0)
Best,
Pacôme
The text was updated successfully, but these errors were encountered:
Hello,
Now that I have the input in the right place, I manage to run Step 0 and 1 successfully.
Now, in the Step 2 - SoftTCNLearning_Supervised.py when running this line :
model = Net(dataset.num_features, dataset.num_classes).to(device)
I get :
It seems that accessing any of the attributes: dataset.num_classes, dataset.num_features, dataset.num_node_features or dataset.num_edge_features produces the same error and it seems to be related to accessing
data.y.size(0)
Best,
Pacôme
The text was updated successfully, but these errors were encountered: