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
c468e068
Commit
c468e068
authored
Oct 05, 2018
by
Minjie Wang
Browse files
some fix
parent
74888fee
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
31 deletions
+9
-31
python/dgl/data/tree.py
python/dgl/data/tree.py
+0
-19
python/dgl/graph.py
python/dgl/graph.py
+8
-10
python/setup.py
python/setup.py
+1
-2
No files found.
python/dgl/data/tree.py
View file @
c468e068
...
...
@@ -79,22 +79,3 @@ class SST(object):
@
property
def
num_vocabs
(
self
):
return
len
(
self
.
vocab
)
@
staticmethod
def
batcher
(
batch
):
nid_with_word
=
[]
wordid
=
[]
label
=
[]
gnid
=
0
for
tree
in
batch
:
for
nid
in
range
(
tree
.
number_of_nodes
()):
if
tree
.
nodes
[
nid
][
'x'
]
!=
SST
.
PAD_WORD
:
nid_with_word
.
append
(
gnid
)
wordid
.
append
(
tree
.
nodes
[
nid
][
'x'
])
label
.
append
(
tree
.
nodes
[
nid
][
'y'
])
gnid
+=
1
batch_trees
=
dgl
.
batch
(
batch
)
return
SSTBatch
(
graph
=
batch_trees
,
nid_with_word
=
F
.
tensor
(
nid_with_word
,
dtype
=
F
.
int64
),
wordid
=
F
.
tensor
(
wordid
,
dtype
=
F
.
int64
),
label
=
F
.
tensor
(
label
,
dtype
=
F
.
int64
))
python/dgl/graph.py
View file @
c468e068
...
...
@@ -826,7 +826,7 @@ class DGLGraph(object):
def
_batch_send
(
self
,
u
,
v
,
message_func
):
if
is_all
(
u
)
and
is_all
(
v
):
u
,
v
,
_
=
self
.
_graph
.
edges
()
self
.
_msg_graph
.
add_edges
(
u
,
v
)
self
.
_msg_graph
.
add_edges
(
u
,
v
)
# TODO(minjie): can be optimized
# call UDF
src_reprs
=
self
.
get_n_repr
(
u
)
edge_reprs
=
self
.
get_e_repr
()
...
...
@@ -1128,30 +1128,28 @@ class DGLGraph(object):
self
.
apply_nodes
(
ALL
,
apply_node_func
)
def
propagate
(
self
,
iterator
=
'bfs
'
,
traverser
=
'topo
'
,
message_func
=
"default"
,
reduce_func
=
"default"
,
apply_node_func
=
"default"
,
**
kwargs
):
"""Propagate messages and update nodes using
iterator
.
"""Propagate messages and update nodes using
graph traversal
.
A convenient function for passing messages and updating
nodes according to the iterator. The iterator can be
any of the pre-defined iterators ('bfs', 'dfs', 'pre-order',
'mid-order', 'post-order'). The computation will be unrolled
in the backend efficiently. User can also provide custom
iterator that generates the edges and nodes.
nodes according to the traverser. The traverser can be
any of the pre-defined traverser (e.g. 'topo'). User can also provide custom
traverser that generates the edges and nodes.
Parameters
----------
traverser : str or generator of edges.
The traverser of the graph.
message_func : str or callable
The message function.
reduce_func : str or callable
The reduce function.
apply_node_func : str or callable
The update function.
iterator : str or generator of steps.
The iterator of the graph.
kwargs : keyword arguments, optional
Arguments for pre-defined iterators.
"""
...
...
python/setup.py
View file @
c468e068
...
...
@@ -17,7 +17,6 @@ setuptools.setup(
'numpy>=1.14.0'
,
'scipy>=1.1.0'
,
'networkx>=2.1'
,
'python-igraph>=0.7.0'
,
],
data_files
=
[(
''
,
[
'VERSION'
])],
url
=
'https://github.com/jermainewang/dgl
-1
'
)
url
=
'https://github.com/jermainewang/dgl'
)
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