"git@developer.sourcefind.cn:OpenDAS/vision.git" did not exist on "979bb72e7908b4be8f56cd458df47a1a2b5fb79c"
Commit aa5bd89f authored by Minjie Wang's avatar Minjie Wang
Browse files

minor change on the supported container type

parent f310e586
...@@ -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)):
......
...@@ -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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment