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
2ef90be0
Unverified
Commit
2ef90be0
authored
Jun 28, 2023
by
peizhou001
Committed by
GitHub
Jun 28, 2023
Browse files
[GraphBolt] Dispatch type edges in neighbor sampling (#5890)
parent
d22049e8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
15 deletions
+19
-15
graphbolt/src/csc_sampling_graph.cc
graphbolt/src/csc_sampling_graph.cc
+19
-15
No files found.
graphbolt/src/csc_sampling_graph.cc
View file @
2ef90be0
...
@@ -340,11 +340,14 @@ torch::Tensor PickByEtype(
...
@@ -340,11 +340,14 @@ torch::Tensor PickByEtype(
fanouts
.
size
(),
torch
::
tensor
({},
options
));
fanouts
.
size
(),
torch
::
tensor
({},
options
));
int64_t
etype_begin
=
offset
;
int64_t
etype_begin
=
offset
;
int64_t
etype_end
=
offset
;
int64_t
etype_end
=
offset
;
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
)
{
while
(
etype_end
<
offset
+
num_neighbors
)
{
int64
_t
etype
=
type_per_edge
[
etype_end
]
.
item
<
int64_t
>
()
;
scalar
_t
etype
=
type_per_edge
_data
[
etype_end
];
int64_t
fanout
=
fanouts
[
etype
];
int64_t
fanout
=
fanouts
[
etype
];
while
(
etype_end
<
offset
+
num_neighbors
&&
while
(
etype_end
<
offset
+
num_neighbors
&&
type_per_edge
[
etype_end
]
.
item
<
int64_t
>
()
==
etype
)
{
type_per_edge
_data
[
etype_end
]
==
etype
)
{
etype_end
++
;
etype_end
++
;
}
}
// Do sampling for one etype.
// Do sampling for one etype.
...
@@ -355,6 +358,7 @@ torch::Tensor PickByEtype(
...
@@ -355,6 +358,7 @@ torch::Tensor PickByEtype(
}
}
etype_begin
=
etype_end
;
etype_begin
=
etype_end
;
}
}
}));
return
torch
::
cat
(
picked_neighbors
,
0
);
return
torch
::
cat
(
picked_neighbors
,
0
);
}
}
...
...
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