-
Notifications
You must be signed in to change notification settings - Fork 48
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
Added node_shuffle
#429
Added node_shuffle
#429
Conversation
# Returns | ||
- `g::GNNGraph`: The GNNGraph with shuffled node features. | ||
""" | ||
function node_shuffle(g::GNNGraph{<:COO_T}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is mutating, so it should be called node_shuffle!
- `g::GNNGraph`: The GNNGraph with shuffled node features. | ||
""" | ||
function node_shuffle(g::GNNGraph{<:COO_T}) | ||
features = g.ndata.x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can have no guarantess that there exists features named x
""" | ||
function node_shuffle(g::GNNGraph{<:COO_T}) | ||
features = g.ndata.x | ||
num_nodes = size(features, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the node dimension is the second one
num_nodes = size(features, 1) | ||
|
||
shuffled_indices = randperm(num_nodes) | ||
shuffled_features = features[shuffled_indices, :] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is shuffling feature dimensions, not nodes
Besides the issues that I commented, I think that this function should not be part of the library. It is not a common operation, it has used in that paper for probing the relevance of node features. This kind of operations should be done on the user side. |
Continues Issue #412
DGL function
Wasn't sure what to test in this one. Please let me know what other tests I should add since this is pretty straightforward.