Replies: 3 comments 3 replies
-
This depends on what you are trying to achieve. If you want to share parameters across the "time" dimension, you should move them outside the feature dimension into the node/batch dimension, i.e., We also have support for static graphs with batch-wise node features, i.e., Do you have a pointer on how DGL handles arbitrary feature shapes? I don't find any reference to this in the doc. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your help! batch_size = 32
node_num = 6
channel_size = 9
seq_len = 128
hidden_size = 256
from torch_geometric.nn import GCNConv
edge_index = torch.tensor([[1,2,3,4,5],
[0,0,0,0,0]])
har_tensor = torch.randn(32, 6, 9, 128)
data = Data(x=har_tensor, edge_index=edge_index)
model = GCNConv(channel_size*seq_len, channel_size*hidden_size)
x = model(data.x.reshape(batch_size, node_num, -1), data.edge_index)
x = x.reshape(batch_size, node_num, channel_size, -1)
print(x.shape)#32*6*9*256 |
Beta Was this translation helpful? Give feedback.
-
Excellent, I just want to do this work! batch_size = 32
node_num = 6
channel_size = 9
time_steps = 4
seq_len = 128
step_seq_len = 32
hidden_size = 256
import torch
from torch_geometric.data import Data
from torch_geometric.nn import GCNConv
edge_index = torch.tensor([[1,2,3,4,5],
[0,0,0,0,0]])
# split to 4 timesteps merge node features
har_tensor = torch.randn(32, 6, 9, 128).reshape(32, 6, 9, 4, 32).permute(0, 3, 1, 2, 4).reshape(32, 4, 6, 9*32)
data = Data(x=har_tensor, edge_index=edge_index)
model = GCNConv(channel_size*step_seq_len, channel_size*hidden_size)
x = model(data.x.reshape(batch_size, time_steps, node_num, -1), data.edge_index)
x = x.reshape(batch_size, time_steps, node_num, channel_size, -1)
print(x.shape)#32*4*6*9*256 In this way, the graph formed by each timestep is messaging and aggregation. The time steps are independent graph structures, and parameters are shared between timesteps, right? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I just started using PYG, how to deal with the high dimensional feature of nodes?
For example, if the node feature dimension is 7*96 and the input data shape is 【Batch, num_nodes, signal_channel, time_slice】, how do I feed the data into the GAT model? 【Num_nodes, signal_channel*time_slice】?
In DGL I can feed the feature as the shape【Batch, num_nodes, signal_channel, time_slice】, how can I do this in PYG?
thanks!
Beta Was this translation helpful? Give feedback.
All reactions