benedekrozemberczki / pytorch_geometric_temporal

PyTorch Geometric Temporal: Spatiotemporal Signal Processing with Neural Machine Learning Models (CIKM 2021)
MIT License
2.62k stars 369 forks source link

issue window vs in_channels #176

Closed michelegentili93 closed 1 year ago

michelegentili93 commented 2 years ago

Sorry to reopen #174 ... but it doesn't work with X having this dimensions: (n_nodes, n_features, window). If I run your example of MPNNLSTM and switch node features with window, even if I reshape the x, it doesn't work and I get this error:

[/usr/local/lib/python3.7/dist-packages/torch_geometric_temporal/nn/recurrent/mpnn_lstm.py] in forward(self, X, edge_index, edge_weight) 80 R = list() 81 ---> 82 S = X.view(-1, self.window, self.num_nodes, self.in_channels)

RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.

I changed the model definition: self.recurrent = MPNNLSTM(1, 32, 32, 20, node_features, 0.5) and the input x in the snapshot: snapshot.x = snapshot.x.reshape(20,1,4)