File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ def aggregate(
1818 owners : torch .Tensor ,
1919 average : bool = True ,
2020 num_owner : Optional [int ] = None ,
21+ use_torch_scatter : bool = has_torch_scatter ,
2122) -> torch .Tensor :
2223 """
2324 Aggregate rows in data by specifying the owners.
@@ -31,13 +32,17 @@ def aggregate(
3132 num_owner : the number of owners, this is needed if the
3233 max idx of owner is not presented in owners tensor
3334 Default = None
35+ use_torch_scatter : if True, use torch_scatter to aggregate,
36+ which is faster and more memory efficient.
37+ if False, use native index_add_.
38+ Default = True if torch_scatter is available, else False
3439
3540 Returns
3641 -------
3742 output: [num_owner, feature_dim]
3843 """
3944 # faster and recommended
40- if has_torch_scatter :
45+ if use_torch_scatter :
4146 output = torch_scatter .segment_coo (
4247 src = data ,
4348 index = owners ,
You can’t perform that action at this time.
0 commit comments