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
72a16b22
Unverified
Commit
72a16b22
authored
Feb 21, 2021
by
Zihao Ye
Committed by
GitHub
Feb 21, 2021
Browse files
[bugfix] Fix the behavior of select_topk (#2688)
* fix * lint * lint
parent
e6bf54cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
python/dgl/sampling/neighbor.py
python/dgl/sampling/neighbor.py
+4
-1
No files found.
python/dgl/sampling/neighbor.py
View file @
72a16b22
...
@@ -252,7 +252,10 @@ def select_topk(g, k, weight, nodes=None, edge_dir='in', ascending=False,
...
@@ -252,7 +252,10 @@ def select_topk(g, k, weight, nodes=None, edge_dir='in', ascending=False,
"""
"""
# Rectify nodes to a dictionary
# Rectify nodes to a dictionary
if
nodes
is
None
:
if
nodes
is
None
:
nodes
=
{
ntype
:
F
.
arange
(
0
,
g
.
number_of_nodes
(
ntype
))
for
ntype
in
g
.
ntypes
}
nodes
=
{
ntype
:
F
.
astype
(
F
.
arange
(
0
,
g
.
number_of_nodes
(
ntype
)),
g
.
idtype
)
for
ntype
in
g
.
ntypes
}
elif
not
isinstance
(
nodes
,
dict
):
elif
not
isinstance
(
nodes
,
dict
):
if
len
(
g
.
ntypes
)
>
1
:
if
len
(
g
.
ntypes
)
>
1
:
raise
DGLError
(
"Must specify node type when the graph is not homogeneous."
)
raise
DGLError
(
"Must specify node type when the graph is not homogeneous."
)
...
...
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