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
3132da28
Unverified
Commit
3132da28
authored
Nov 15, 2022
by
peizhou001
Committed by
GitHub
Nov 15, 2022
Browse files
Deprecate (#4864)
rename DGLHeteroGraph to DGLGraph
parent
ee9887d6
Changes
45
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
11 deletions
+11
-11
python/dgl/utils/checks.py
python/dgl/utils/checks.py
+3
-3
python/dgl/utils/internal.py
python/dgl/utils/internal.py
+1
-1
python/dgl/view.py
python/dgl/view.py
+2
-2
tests/compute/test_batched_heterograph.py
tests/compute/test_batched_heterograph.py
+4
-4
tests/compute/test_pickle.py
tests/compute/test_pickle.py
+1
-1
No files found.
python/dgl/utils/checks.py
View file @
3132da28
...
@@ -19,7 +19,7 @@ def prepare_tensor(g, data, name):
...
@@ -19,7 +19,7 @@ def prepare_tensor(g, data, name):
Parameters
Parameters
----------
----------
g : DGL
Hetero
Graph
g : DGLGraph
Graph.
Graph.
data : int, iterable of int, tensor
data : int, iterable of int, tensor
Data.
Data.
...
@@ -77,7 +77,7 @@ def prepare_tensor_dict(g, data, name):
...
@@ -77,7 +77,7 @@ def prepare_tensor_dict(g, data, name):
Parameters
Parameters
----------
----------
g : DGL
Hetero
Graph
g : DGLGraph
Graph.
Graph.
data : dict[str, (int, iterable of int, tensor)]
data : dict[str, (int, iterable of int, tensor)]
Data dict.
Data dict.
...
@@ -99,7 +99,7 @@ def prepare_tensor_or_dict(g, data, name):
...
@@ -99,7 +99,7 @@ def prepare_tensor_or_dict(g, data, name):
Parameters
Parameters
----------
----------
g : DGL
Hetero
Graph
g : DGLGraph
Graph.
Graph.
data : dict[str, (int, iterable of int, tensor)]
data : dict[str, (int, iterable of int, tensor)]
Data dict.
Data dict.
...
...
python/dgl/utils/internal.py
View file @
3132da28
...
@@ -620,7 +620,7 @@ def expand_as_pair(input_, g=None):
...
@@ -620,7 +620,7 @@ def expand_as_pair(input_, g=None):
----------
----------
input_ : Tensor, dict[str, Tensor], or their pairs
input_ : Tensor, dict[str, Tensor], or their pairs
The input features
The input features
g :
DGLHeteroGraph or
DGLGraph or None
g : DGLGraph or None
The graph.
The graph.
If None, skip checking if the graph is a block.
If None, skip checking if the graph is a block.
...
...
python/dgl/view.py
View file @
3132da28
...
@@ -13,7 +13,7 @@ EdgeSpace = namedtuple("EdgeSpace", ["data"])
...
@@ -13,7 +13,7 @@ EdgeSpace = namedtuple("EdgeSpace", ["data"])
class
HeteroNodeView
(
object
):
class
HeteroNodeView
(
object
):
"""A NodeView class to act as G.nodes for a DGL
Hetero
Graph."""
"""A NodeView class to act as G.nodes for a DGLGraph."""
__slots__
=
[
"_graph"
,
"_typeid_getter"
]
__slots__
=
[
"_graph"
,
"_typeid_getter"
]
...
@@ -140,7 +140,7 @@ class HeteroNodeDataView(MutableMapping):
...
@@ -140,7 +140,7 @@ class HeteroNodeDataView(MutableMapping):
class
HeteroEdgeView
(
object
):
class
HeteroEdgeView
(
object
):
"""A EdgeView class to act as G.edges for a DGL
Hetero
Graph."""
"""A EdgeView class to act as G.edges for a DGLGraph."""
__slots__
=
[
"_graph"
]
__slots__
=
[
"_graph"
]
...
...
tests/compute/test_batched_heterograph.py
View file @
3132da28
...
@@ -48,7 +48,7 @@ def check_equivalence_between_heterographs(g1, g2, node_attrs=None, edge_attrs=N
...
@@ -48,7 +48,7 @@ def check_equivalence_between_heterographs(g1, g2, node_attrs=None, edge_attrs=N
@
pytest
.
mark
.
parametrize
(
'gs'
,
get_cases
([
'two_hetero_batch'
]))
@
pytest
.
mark
.
parametrize
(
'gs'
,
get_cases
([
'two_hetero_batch'
]))
@
parametrize_idtype
@
parametrize_idtype
def
test_topology
(
gs
,
idtype
):
def
test_topology
(
gs
,
idtype
):
"""Test batching two DGL
Hetero
Graphs where some nodes are isolated in some relations"""
"""Test batching two DGLGraphs where some nodes are isolated in some relations"""
g1
,
g2
=
gs
g1
,
g2
=
gs
g1
=
g1
.
astype
(
idtype
).
to
(
F
.
ctx
())
g1
=
g1
.
astype
(
idtype
).
to
(
F
.
ctx
())
g2
=
g2
.
astype
(
idtype
).
to
(
F
.
ctx
())
g2
=
g2
.
astype
(
idtype
).
to
(
F
.
ctx
())
...
@@ -112,7 +112,7 @@ def test_topology(gs, idtype):
...
@@ -112,7 +112,7 @@ def test_topology(gs, idtype):
@
parametrize_idtype
@
parametrize_idtype
def
test_batching_batched
(
idtype
):
def
test_batching_batched
(
idtype
):
"""Test batching a DGL
Hetero
Graph and a
B
atchedDGL
Hetero
Graph."""
"""Test batching a DGLGraph and a
b
atched
DGLGraph."""
g1
=
dgl
.
heterograph
({
g1
=
dgl
.
heterograph
({
(
'user'
,
'follows'
,
'user'
):
([
0
,
1
],
[
1
,
2
]),
(
'user'
,
'follows'
,
'user'
):
([
0
,
1
],
[
1
,
2
]),
(
'user'
,
'plays'
,
'game'
):
([
0
,
1
],
[
0
,
0
])
(
'user'
,
'plays'
,
'game'
):
([
0
,
1
],
[
0
,
0
])
...
@@ -170,7 +170,7 @@ def test_batching_batched(idtype):
...
@@ -170,7 +170,7 @@ def test_batching_batched(idtype):
@
parametrize_idtype
@
parametrize_idtype
def
test_features
(
idtype
):
def
test_features
(
idtype
):
"""Test the features of batched DGL
Hetero
Graphs"""
"""Test the features of batched DGLGraphs"""
g1
=
dgl
.
heterograph
({
g1
=
dgl
.
heterograph
({
(
'user'
,
'follows'
,
'user'
):
([
0
,
1
],
[
1
,
2
]),
(
'user'
,
'follows'
,
'user'
):
([
0
,
1
],
[
1
,
2
]),
(
'user'
,
'plays'
,
'game'
):
([
0
,
1
],
[
0
,
0
])
(
'user'
,
'plays'
,
'game'
):
([
0
,
1
],
[
0
,
0
])
...
@@ -245,7 +245,7 @@ def test_features(idtype):
...
@@ -245,7 +245,7 @@ def test_features(idtype):
@
unittest
.
skipIf
(
F
.
backend_name
==
'mxnet'
,
reason
=
"MXNet does not support split array with zero-length segment."
)
@
unittest
.
skipIf
(
F
.
backend_name
==
'mxnet'
,
reason
=
"MXNet does not support split array with zero-length segment."
)
@
parametrize_idtype
@
parametrize_idtype
def
test_empty_relation
(
idtype
):
def
test_empty_relation
(
idtype
):
"""Test the features of batched DGL
Hetero
Graphs"""
"""Test the features of batched DGLGraphs"""
g1
=
dgl
.
heterograph
({
g1
=
dgl
.
heterograph
({
(
'user'
,
'follows'
,
'user'
):
([
0
,
1
],
[
1
,
2
]),
(
'user'
,
'follows'
,
'user'
):
([
0
,
1
],
[
1
,
2
]),
(
'user'
,
'plays'
,
'game'
):
([],
[])
(
'user'
,
'plays'
,
'game'
):
([],
[])
...
...
tests/compute/test_pickle.py
View file @
3132da28
...
@@ -122,7 +122,7 @@ def test_pickling_batched_heterograph():
...
@@ -122,7 +122,7 @@ def test_pickling_batched_heterograph():
g2
.
nodes
[
'game'
].
data
[
'g_h'
]
=
F
.
randn
((
2
,
5
))
g2
.
nodes
[
'game'
].
data
[
'g_h'
]
=
F
.
randn
((
2
,
5
))
g2
.
edges
[
'plays'
].
data
[
'p_h'
]
=
F
.
randn
((
4
,
6
))
g2
.
edges
[
'plays'
].
data
[
'p_h'
]
=
F
.
randn
((
4
,
6
))
bg
=
dgl
.
batch
_hetero
([
g
,
g2
])
bg
=
dgl
.
batch
([
g
,
g2
])
new_bg
=
_reconstruct_pickle
(
bg
)
new_bg
=
_reconstruct_pickle
(
bg
)
test_utils
.
check_graph_equal
(
bg
,
new_bg
)
test_utils
.
check_graph_equal
(
bg
,
new_bg
)
...
...
Prev
1
2
3
Next
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