Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorporating vector node features #10

Closed
patriksimurka opened this issue Mar 26, 2024 · 1 comment
Closed

Incorporating vector node features #10

patriksimurka opened this issue Mar 26, 2024 · 1 comment

Comments

@patriksimurka
Copy link

Hi, nice work! I was wondering what it would take to accommodate for systems with nodes that have additional non-scalar features. Any hints or snippets would be greatly appreciated. Thanks.

@yilunliao
Copy link
Member

Hi @patriksimurka

The node embeddings have the shape (num_nodes, (1 + L_{max}) ** 2, num_channels).
To add scalars to the node embeddings, we can first expand the scalar properties to have num_channels channels, and then add those scalar vectors to the type-0 part:

num_channels = 128
lmax = 6
num_nodes = 128
node_embedding = torch.randn(num_nodes, (1 + lmax) ** 2, num_channels)
input_scalar = torch.randn(num_nodes, 1, num_channels)
node_embedding[:, 0:1, :] = node_embedding[:, 0:1, :] + input_scalar

For type-1 vectors, you can do the following:

type_1_vectors = torch.randn(num_nodes, 3, num_channels)
node_embedding[:, 1:4, :] = node_embedding[:, 1:4, :] + type_1_vectors

Basically, the second dimension of node_embedding in the above examples corresponds to [one type-0 vector, one type-1 vector, ... one type-lmax vector]. So you can just add the type-L vector to the corresponding slice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants