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

NeighborLoader: support temporal sampling with (FeatureStore, GraphStore) #4929

Merged
merged 5 commits into from
Jul 7, 2022

Conversation

mananshah99
Copy link
Contributor

Supports temporal sampling by performing the equivalent of a collect() operation on FeatureStore to construct node_time_dict. Also fixes a minor bug in HeteroData.put_tensor.

@codecov
Copy link

codecov bot commented Jul 6, 2022

Codecov Report

Merging #4929 (cb1c936) into master (fdb1ab0) will decrease coverage by 0.00%.
The diff coverage is 61.11%.

@@            Coverage Diff             @@
##           master    #4929      +/-   ##
==========================================
- Coverage   82.71%   82.70%   -0.01%     
==========================================
  Files         330      330              
  Lines       17870    17882      +12     
==========================================
+ Hits        14781    14790       +9     
- Misses       3089     3092       +3     
Impacted Files Coverage Δ
torch_geometric/loader/neighbor_loader.py 85.62% <0.00%> (-0.54%) ⬇️
torch_geometric/data/data.py 91.27% <80.00%> (-0.14%) ⬇️
torch_geometric/data/hetero_data.py 93.86% <87.50%> (-0.18%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fdb1ab0...cb1c936. Read the comment docs.

test/loader/test_neighbor_loader.py Outdated Show resolved Hide resolved
torch_geometric/loader/neighbor_loader.py Show resolved Hide resolved
if isinstance(input_nodes, str):
num_nodes = feature_store.get_tensor_size(input_nodes)[0]
return input_nodes, range(num_nodes)
raise NotImplementedError(
Copy link
Member

Choose a reason for hiding this comment

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

Why do we raise here instead of fix it? Shouldn't feature_store.get_tensor_size(TensorAttr(group_name=input_nodes))[0] fix this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That get tensor size call wouldn't work as intended since get tensor rise needs both a group name and are name, hence the raise

Copy link
Member

Choose a reason for hiding this comment

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

So what we could do is to select the first TensorAttr that has group_name==input_nodes, right? But yeah, not ideal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, not a huge fan of that solution; will leave for a later PR if we have to go that route.


if isinstance(input_nodes, (list, tuple)):
assert len(input_nodes) == 2
assert isinstance(input_nodes[0], str)

node_type, input_nodes = input_nodes
if input_nodes is None:
num_nodes = feature_store.get_tensor_size(input_nodes)[0]
return input_nodes[0], range(num_nodes)
raise NotImplementedError(
Copy link
Member

Choose a reason for hiding this comment

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

feature_store.get_tensor_size(TensorAttr(group_name=None))[0]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same reason as above.

@mananshah99 mananshah99 merged commit db5e6d9 into master Jul 7, 2022
@mananshah99 mananshah99 deleted the fs_temporal_sampling branch July 7, 2022 22:00
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