Unverified Commit 09ade2f2 authored by Zihao Ye's avatar Zihao Ye Committed by GitHub
Browse files

upd (#1321)

parent 19797bb6
...@@ -217,4 +217,5 @@ out their price: ...@@ -217,4 +217,5 @@ out their price:
Please note that containers are NOT meant for passing a large collection of Please note that containers are NOT meant for passing a large collection of
items from/to C APIs. It will be quite slow in these cases. It is recommended items from/to C APIs. It will be quite slow in these cases. It is recommended
to benchmark first. As an alternative, use NDArray for a large collection of to benchmark first. As an alternative, use NDArray for a large collection of
numerical values and use BatchedDGLGraph for a lot of graphs. numerical values and use ``dgl.batch`` to batch a lot of ``DGLGraph``'s into
a single ``DGLGraph``.
...@@ -28,7 +28,8 @@ class GraphData(ObjectBase): ...@@ -28,7 +28,8 @@ class GraphData(ObjectBase):
@staticmethod @staticmethod
def create(g: DGLGraph): def create(g: DGLGraph):
"""Create GraphData""" """Create GraphData"""
assert g.batch_size == 1, "BatchedDGLGraph is not supported for serialization" # TODO(zihao): support serialize batched graph in the future.
assert g.batch_size == 1, "Batched DGLGraph is not supported for serialization"
ghandle = g._graph ghandle = g._graph
if len(g.ndata) != 0: if len(g.ndata) != 0:
node_tensors = dict() node_tensors = dict()
......
...@@ -962,7 +962,7 @@ class DGLGraph(DGLBaseGraph): ...@@ -962,7 +962,7 @@ class DGLGraph(DGLBaseGraph):
self._batch_num_nodes = batch_num_nodes self._batch_num_nodes = batch_num_nodes
self._batch_num_edges = batch_num_edges self._batch_num_edges = batch_num_edges
# set parent if the graph is a induced subgraph. # set parent if the graph is a subgraph.
self._parent = parent self._parent = parent
def _create_subgraph(self, sgi, induced_nodes, induced_edges): def _create_subgraph(self, sgi, induced_nodes, induced_edges):
...@@ -1893,7 +1893,7 @@ class DGLGraph(DGLBaseGraph): ...@@ -1893,7 +1893,7 @@ class DGLGraph(DGLBaseGraph):
@property @property
def parent(self): def parent(self):
"""If current graph is a induced subgraph of a parent graph, return """If current graph is a subgraph of a parent graph, return
its parent graph, else return None. its parent graph, else return None.
Returns Returns
......
...@@ -110,7 +110,7 @@ class GATLayer(nn.Module): ...@@ -110,7 +110,7 @@ class GATLayer(nn.Module):
Parameters Parameters
---------- ----------
bg : BatchedDGLGraph bg : DGLGraph
Batched DGLGraphs for processing multiple molecules in parallel Batched DGLGraphs for processing multiple molecules in parallel
feats : FloatTensor of shape (N, M1) feats : FloatTensor of shape (N, M1)
* N is the total number of atoms in the batched graph * N is the total number of atoms in the batched graph
......
...@@ -167,7 +167,7 @@ def test_laplacian_lambda_max(): ...@@ -167,7 +167,7 @@ def test_laplacian_lambda_max():
g = dgl.DGLGraph(nx.erdos_renyi_graph(N, 0.3)) g = dgl.DGLGraph(nx.erdos_renyi_graph(N, 0.3))
l_max = dgl.laplacian_lambda_max(g) l_max = dgl.laplacian_lambda_max(g)
assert (l_max[0] < 2 + eps) assert (l_max[0] < 2 + eps)
# test BatchedDGLGraph # test batched DGLGraph
N_arr = [20, 30, 10, 12] N_arr = [20, 30, 10, 12]
bg = dgl.batch([ bg = dgl.batch([
dgl.DGLGraph(nx.erdos_renyi_graph(N, 0.3)) dgl.DGLGraph(nx.erdos_renyi_graph(N, 0.3))
......
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