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
09ade2f2
Unverified
Commit
09ade2f2
authored
Mar 06, 2020
by
Zihao Ye
Committed by
GitHub
Mar 06, 2020
Browse files
upd (#1321)
parent
19797bb6
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
6 deletions
+8
-6
docs/source/developer/ffi.rst
docs/source/developer/ffi.rst
+2
-1
python/dgl/data/graph_serialize.py
python/dgl/data/graph_serialize.py
+2
-1
python/dgl/graph.py
python/dgl/graph.py
+2
-2
python/dgl/model_zoo/chem/gnn.py
python/dgl/model_zoo/chem/gnn.py
+1
-1
tests/compute/test_transform.py
tests/compute/test_transform.py
+1
-1
No files found.
docs/source/developer/ffi.rst
View file @
09ade2f2
...
@@ -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``.
python/dgl/data/graph_serialize.py
View file @
09ade2f2
...
@@ -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
()
...
...
python/dgl/graph.py
View file @
09ade2f2
...
@@ -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
...
...
python/dgl/model_zoo/chem/gnn.py
View file @
09ade2f2
...
@@ -110,7 +110,7 @@ class GATLayer(nn.Module):
...
@@ -110,7 +110,7 @@ class GATLayer(nn.Module):
Parameters
Parameters
----------
----------
bg :
Batched
DGLGraph
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
...
...
tests/compute/test_transform.py
View file @
09ade2f2
...
@@ -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
B
atchedDGLGraph
# test
b
atched
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
))
...
...
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