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
aa5bd89f
"git@developer.sourcefind.cn:OpenDAS/vision.git" did not exist on "979bb72e7908b4be8f56cd458df47a1a2b5fb79c"
Commit
aa5bd89f
authored
Jun 15, 2018
by
Minjie Wang
Browse files
minor change on the supported container type
parent
f310e586
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
python/dgl/graph.py
python/dgl/graph.py
+1
-1
python/dgl/utils.py
python/dgl/utils.py
+3
-3
No files found.
python/dgl/graph.py
View file @
aa5bd89f
...
@@ -212,7 +212,7 @@ class DGLGraph(DiGraph):
...
@@ -212,7 +212,7 @@ class DGLGraph(DiGraph):
Nodes with pre-computed messages to u. Default is all
Nodes with pre-computed messages to u. Default is all
the predecessors.
the predecessors.
"""
"""
u_is_container
=
type
(
u
)
in
(
list
,
tuple
)
u_is_container
=
isinstance
(
u
,
list
)
u_is_tensor
=
isinstance
(
u
,
Tensor
)
u_is_tensor
=
isinstance
(
u
,
Tensor
)
# TODO(minjie): tensorize the loop.
# TODO(minjie): tensorize the loop.
for
i
,
uu
in
enumerate
(
utils
.
node_iter
(
u
)):
for
i
,
uu
in
enumerate
(
utils
.
node_iter
(
u
)):
...
...
python/dgl/utils.py
View file @
aa5bd89f
...
@@ -2,7 +2,7 @@ import dgl.backend as F
...
@@ -2,7 +2,7 @@ import dgl.backend as F
from
dgl.backend
import
Tensor
from
dgl.backend
import
Tensor
def
node_iter
(
n
):
def
node_iter
(
n
):
n_is_container
=
type
(
n
)
in
(
list
,
tuple
)
n_is_container
=
isinstance
(
n
,
list
)
n_is_tensor
=
isinstance
(
n
,
Tensor
)
n_is_tensor
=
isinstance
(
n
,
Tensor
)
if
n_is_tensor
:
if
n_is_tensor
:
n
=
F
.
asnumpy
(
n
)
n
=
F
.
asnumpy
(
n
)
...
@@ -15,8 +15,8 @@ def node_iter(n):
...
@@ -15,8 +15,8 @@ def node_iter(n):
yield
n
yield
n
def
edge_iter
(
u
,
v
):
def
edge_iter
(
u
,
v
):
u_is_container
=
type
(
u
)
in
(
list
,
tuple
)
u_is_container
=
isinstance
(
u
,
list
)
v_is_container
=
type
(
v
)
in
(
list
,
tuple
)
v_is_container
=
isinstance
(
v
,
list
)
u_is_tensor
=
isinstance
(
u
,
Tensor
)
u_is_tensor
=
isinstance
(
u
,
Tensor
)
v_is_tensor
=
isinstance
(
v
,
Tensor
)
v_is_tensor
=
isinstance
(
v
,
Tensor
)
if
u_is_tensor
:
if
u_is_tensor
:
...
...
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