Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dgl
Commits
69d9b726
Unverified
Commit
69d9b726
authored
Jun 29, 2023
by
peizhou001
Committed by
GitHub
Jun 29, 2023
Browse files
[Graphbolt] Use binary search in neighbor sample (#5891)
parent
381421b7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
graphbolt/src/csc_sampling_graph.cc
graphbolt/src/csc_sampling_graph.cc
+7
-6
No files found.
graphbolt/src/csc_sampling_graph.cc
View file @
69d9b726
...
...
@@ -343,13 +343,14 @@ torch::Tensor PickByEtype(
AT_DISPATCH_INTEGRAL_TYPES
(
type_per_edge
.
scalar_type
(),
"PickByEtype"
,
([
&
]
{
const
scalar_t
*
type_per_edge_data
=
type_per_edge
.
data_ptr
<
scalar_t
>
();
while
(
etype_end
<
offset
+
num_neighbors
)
{
scalar_t
etype
=
type_per_edge_data
[
etype_end
];
const
auto
end
=
offset
+
num_neighbors
;
while
(
etype_begin
<
end
)
{
scalar_t
etype
=
type_per_edge_data
[
etype_begin
];
int64_t
fanout
=
fanouts
[
etype
];
while
(
etype_end
<
offset
+
num_neighbors
&&
type_per_edge_data
[
etype_
end
]
==
etype
)
{
etype
_end
++
;
}
auto
etype_end
_it
=
std
::
upper_bound
(
type_per_edge_data
+
etype_
begin
,
type_per_edge_data
+
end
,
etype
)
;
etype_end
=
etype_end_it
-
type_per_edge_data
;
// Do sampling for one etype.
if
(
fanout
!=
0
)
{
picked_neighbors
[
etype
]
=
Pick
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment