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 am getting with torch=2.5.1, torch_geometric=2.4.0 and torch_geometric_temporal=0.54.0 and the following simple script:
from torch_geometric_temporal.signal import DynamicGraphTemporalSignal
import torch
import torch_geometric_temporal
import torch_geometric
print(torch_geometric_temporal.__version__)
print(torch_geometric.__version__)
# Node features for each time step (varying number of nodes)
node_features = [
torch.tensor([[1, 2], [3, 4], [5, 6]], dtype=torch.float),
torch.tensor([[2, 3], [4, 5]], dtype=torch.float),
torch.tensor([[3, 4], [5, 6], [7, 8], [9, 10]], dtype=torch.float)
]
# Edge indices for each time step
edge_indices = [
torch.tensor([[0, 1], [1, 2]], dtype=torch.long).t(),
torch.tensor([[0, 1]], dtype=torch.long).t(),
torch.tensor([[0, 1], [1, 2], [2, 3]], dtype=torch.long).t()
]
# Define edge attributes (optional)
edge_attributes = [
torch.tensor([[0.1], [0.2]], dtype=torch.float),
torch.tensor([[0.3]], dtype=torch.float),
torch.tensor([[0.5], [0.6], [0.7]], dtype=torch.float)
]
# Define targets for each time step (optional)
targets = [
torch.tensor([0.5, 0.6, 0.7], dtype=torch.float),
torch.tensor([0.6, 0.7], dtype=torch.float),
torch.tensor([0.7, 0.8, 0.9, 1.0], dtype=torch.float)
]
# Create a DynamicGraphTemporalSignal object
temporal_graph = DynamicGraphTemporalSignal(edge_indices, node_features, edge_attributes, targets)
print(temporal_graph[0])
The following error: AttributeError: 'torch.dtype' object has no attribute 'kind' stemming from the getitem call in temporal_graph[0].
It comes from this part in DynamicGraphTemporalSignal:
def _get_target(self, time_index: int):
if self.targets[time_index] is None:
return self.targets[time_index]
else:
if not self.targets[time_index].dtype.kind == "i":
return torch.LongTensor(self.targets[time_index])
elif not self.targets[time_index].dtype.kind == "f":
return torch.FloatTensor(self.targets[time_index])
Switching it to:
def _get_target(self, time_index: int):
if self.targets[time_index] is None:
return self.targets[time_index]
else:
if not self.targets[time_index].dtype.is_floating_point:
return torch.FloatTensor(self.targets[time_index])
else:
return torch.LongTensor(self.targets[time_index])
fixed it.
This is a probably a torch version mismatch. Can you validate my versions? Otherwise I will just keep the workaround.
Best regards and thank you!
The text was updated successfully, but these errors were encountered:
Hi!
I am getting with torch=2.5.1, torch_geometric=2.4.0 and torch_geometric_temporal=0.54.0 and the following simple script:
The following error:
AttributeError: 'torch.dtype' object has no attribute 'kind'
stemming from the getitem call intemporal_graph[0]
.It comes from this part in DynamicGraphTemporalSignal:
Switching it to:
fixed it.
This is a probably a torch version mismatch. Can you validate my versions? Otherwise I will just keep the workaround.
Best regards and thank you!
The text was updated successfully, but these errors were encountered: