-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
refactor(sampler): consolidate link neighbor sampling interface, part 2 #5365
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
…ric into remote_backend_2
Codecov Report
@@ Coverage Diff @@
## master #5365 +/- ##
==========================================
+ Coverage 83.35% 83.39% +0.04%
==========================================
Files 342 342
Lines 18771 18771
==========================================
+ Hits 15646 15654 +8
+ Misses 3125 3117 -8
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
for more information, see https://pre-commit.ci
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 looks perfect :)
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.
Thanks. This looks good.
Didn't get around to reviewing before merged.. but all looks great to me :-) |
This PR continues the effort to consolidate PyG's sampling interface in preparation for moving `sample(...)` behind the `GraphStore` interface. This effort is somewhat large in scope and will be broken into multiple PRs for ease of review. It resolves some TODOs from #5365. The major change removes special handling of `input_type` and `perm` / `perm_dict` in the neighbor loader. This enables a full separation between the sampler interface and the NeighborLoader (the only other interaction that is not clearly documented or exposed well in the sampler class is `SamplerOutput.metadata`, which will take a bit more work to properly define.
This PR continues the effort to consolidate PyG's sampling interface in preparation for moving
sample(...)
behind theGraphStore
interface. This effort is somewhat large in scope and will be broken into multiple PRs for ease of review. It resolves some TODOs from #5312, and introduces others that will be resolved in follow-up PRs.The major change removes
LinkNeighborSampler
, consolidating it under a the commonBaseSampler
interface withNeighborSampler
. In doing so, it modifies theBaseSampler
interface to supportsample_from_nodes
andsample_from_edges
, since oftentimes edge-based sampling applies some transformations and then re-uses the same logic as node-based sampling. A sampler need not define both node-based and edge-based sampling, but if it doesn't, an appropriate error will be raised.Resolved TODOs:
LinkNeighborSampler
andNeighborSampler
interfaces are alignededge_type_to_str
infilter_*
perm_dict
, which removes the need foredge_type_to_str
entirely