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

Add IndexToMask and MaskToIndex transforms #5375

Merged
merged 11 commits into from
Sep 15, 2022

Conversation

hatemhelal
Copy link
Contributor

Both of these transforms will try to infer the right attributes to convert.

  • MaskToIndex matches any attributes that end with _mask
  • IndexToMask matches any attributes that end with _indices.

For the latter case, it would be a problem to automatically convert edge_index so I went with this suffix.

@codecov
Copy link

codecov bot commented Sep 7, 2022

Codecov Report

Merging #5375 (faf5e97) into master (36244de) will increase coverage by 0.05%.
The diff coverage is 96.55%.

@@            Coverage Diff             @@
##           master    #5375      +/-   ##
==========================================
+ Coverage   83.39%   83.45%   +0.05%     
==========================================
  Files         347      348       +1     
  Lines       18849    18907      +58     
==========================================
+ Hits        15720    15778      +58     
  Misses       3129     3129              
Impacted Files Coverage Δ
torch_geometric/transforms/mask.py 96.49% <96.49%> (ø)
torch_geometric/transforms/__init__.py 100.00% <100.00%> (ø)
torch_geometric/data/storage.py 82.07% <0.00%> (+0.31%) ⬆️
torch_geometric/utils/mask.py 100.00% <0.00%> (+9.09%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@hatemhelal hatemhelal marked this pull request as ready for review September 7, 2022 19:28
Copy link
Member

@rusty1s rusty1s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mostly looks good, thank you! Left some nitpicky comments. One thing I would like to add is HeteroData support. If this is too much to handle, we can add it in a follow-up PR.

torch_geometric/transforms/__init__.py Outdated Show resolved Hide resolved
torch_geometric/transforms/mask.py Outdated Show resolved Hide resolved
torch_geometric/transforms/mask.py Outdated Show resolved Hide resolved
torch_geometric/transforms/mask.py Outdated Show resolved Hide resolved
torch_geometric/transforms/mask.py Outdated Show resolved Hide resolved
torch_geometric/transforms/mask.py Outdated Show resolved Hide resolved
test/transforms/test_index_to_mask.py Outdated Show resolved Hide resolved
@rusty1s
Copy link
Member

rusty1s commented Sep 9, 2022

Hey @hatemhelal. Can you give me write access to your fork/your PR?

Copy link
Member

@rusty1s rusty1s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@rusty1s rusty1s merged commit b1af4c5 into pyg-team:master Sep 15, 2022
@hatemhelal hatemhelal deleted the masking-transforms branch September 21, 2022 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants