Commit c468e068 authored by Minjie Wang's avatar Minjie Wang
Browse files

some fix

parent 74888fee
......@@ -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))
......@@ -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.
"""
......
......@@ -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')
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