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
When using TSAGCN from torch_geometric_temporal, I encountered the following error:
File "lib/python3.8/site-packages/torch_geometric_temporal/nn/attention/tsagcn.py", line 260, in forward
y = self._adaptive_forward(x, y)
File "lib/python3.8/site-packages/torch_geometric_temporal/nn/attention/tsagcn.py", line 237, in _adaptive_forward
A2 = self.conv_b[i](x).view(N, self.inter_c * T, V)
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.
This error occurs in _adaptive_forward() when calling .view() on a tensor that is not memory-contiguous.
Expected Behavior
The model should process the input without error.
Actual Behavior
The model crashes due to .view() being used on a non-contiguous tensor.
import torch
from torch_geometric.data import Data
from torch_geometric_temporal.nn.attention import AAGCN
# Define the graph that produces the error
x = torch.rand(2, 80, 1556, 1)
edge_index = torch.randint(0, 2, (2, 18456), dtype=torch.long)
y = torch.rand(2, 2)
# Create the graph object
graph = Data(x=x, edge_index=edge_index, y=y)
# Create the AAGCN layer (Attention Aggregated Graph Convolutional Network)
aagcn = AAGCN(in_channels=1,
out_channels=16,
edge_index=edge_index,
num_nodes=2,
adaptive=True,
attention=True)
# Forward pass (this is where the original issue happens)
x = x.permute(0, 3, 1, 2).contiguous() # Batch, Features_In, Temporal_In, Node_Number
# This will raise the 'view' error in some cases
output = aagcn(x)
current code in torch_geometric_temporal/nn/attention/tsagcn.py#237 A2 = self.conv_b[i](x).view(N, self.inter_c * T, V)
When using TSAGCN from torch_geometric_temporal, I encountered the following error:
This error occurs in _adaptive_forward() when calling .view() on a tensor that is not memory-contiguous.
Expected Behavior
The model should process the input without error.
Actual Behavior
The model crashes due to .view() being used on a non-contiguous tensor.
System Information
Example to reproduce:
current code in torch_geometric_temporal/nn/attention/tsagcn.py#237
A2 = self.conv_b[i](x).view(N, self.inter_c * T, V)
proposed fix:
A2 = self.conv_b[i](x).reshape(N, self.inter_c * T, V)
The text was updated successfully, but these errors were encountered: