-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Filter out empty tensors inside trim_to_layer
#7942
Conversation
… `trim_to_layer` function Signed-off-by: Liu,Kaixuan <[email protected]>
Signed-off-by: Liu,Kaixuan <[email protected]>
Can we add an additional test for this? Do you have some benchmark on the speed-up? |
trim_to_layer
Sure, will add related test case and benchmark data afterwards. |
I tried to use examples/hetero/hierarchical_sage.py to do benchmark, but as the dataset(ogbn-mags) is not big enough, so there is no obvious speed up. However, when I changed to larger dataset(igbh-medium), which is called from GLTorch, the time consumption drops from 7:23:39 to 6:43:24. |
Hi @kaixuanliu @rusty1s , I have some questions about this. a) Are the two cases tested (with and without filtering-out) numerically equivalent? I suppose they should. b) Is there any chance of corner cases for which, after some 'trimming' only one kind of tensor is empty (say c) Is it reasonable to think that the performance gain may be connected to the size AND the topology of the graph? d) Are any drop in performance possible (in some scenarios) for the additional calls (and for loops) added here? Thanks very much! |
Hi @andreazanetti , I try to answer your questions. And @rusty1s maybe you can help correct my answer if I have some mis-understandings.
|
Apologies for the delay in my reply. I was off sick. a) Are the two cases tested (with and without filtering-out) numerically equivalent? I suppose they should. b) Is there any chance of corner cases for which, after some 'trimming' only one kind of tensor is empty (say edge_index) but not another (say x is not)? Would that situation be problematic once the removal happens only for one of the 2? c) Is it reasonable to think that the performance gain may be connected to the size AND the topology of the graph? d) Are any drop in performance possible (in some scenarios) for the additional calls (and for loops) added here? |
|
Signed-off-by: Liu,Kaixuan <[email protected]>
@rusty1s @andreazanetti @rfdavid , Hi, I added related unit test, but seems there is sth wrong with test/loader/test_imbalanced_sampler.py file, so cannot get all test cases passed. |
Should be fixed now. |
Codecov Report
@@ Coverage Diff @@
## master #7942 +/- ##
=======================================
Coverage 89.58% 89.58%
=======================================
Files 461 461
Lines 26970 26980 +10
=======================================
+ Hits 24160 24170 +10
Misses 2810 2810
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Signed-off-by: Liu,Kaixuan <[email protected]>
Co-authored-by: Jintang Li <[email protected]>
filter out empty tensor for `x`, `edge_index`, `edge_attr` after calling `trim_to_layer` function. This can avoid unnecessary computation when some node/edge types get empty output. For example: when I train `igbh-tiny` dataset with 3 hops sampler and use `trim_to_layer` function, I get a lot of empty edge_index tensor for edge type '('author', 'affiliated_to', 'institute')', but the feature tensor for 'author' node type is still sent to compute in `HeteroConv` implementation. --------- Signed-off-by: Liu,Kaixuan <[email protected]> Co-authored-by: Matthias Fey <[email protected]> Co-authored-by: Jintang Li <[email protected]>
filter out empty tensor for
x
,edge_index
,edge_attr
after callingtrim_to_layer
function. This can avoid unnecessary computation when some node/edge types get empty output. For example: when I trainigbh-tiny
dataset with 3 hops sampler and usetrim_to_layer
function, I get a lot of empty edge_index tensor for edge type '('author', 'affiliated_to', 'institute')', but the feature tensor for 'author' node type is still sent to compute inHeteroConv
implementation.