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
ab0c0ec6
"tests/git@developer.sourcefind.cn:OpenDAS/dgl.git" did not exist on "5a2451047fd8156a86bcfa6fd157a3f31328726e"
Unverified
Commit
ab0c0ec6
authored
Jan 06, 2023
by
peizhou001
Committed by
GitHub
Jan 06, 2023
Browse files
[API Deprecation] Deprecate candidates in convert module (#4988) (#5115)
parent
46a3fc2b
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
16 additions
and
74 deletions
+16
-74
python/dgl/convert.py
python/dgl/convert.py
+2
-62
python/dgl/distributed/dist_graph.py
python/dgl/distributed/dist_graph.py
+3
-1
python/dgl/nn/mxnet/conv/gmmconv.py
python/dgl/nn/mxnet/conv/gmmconv.py
+1
-1
python/dgl/nn/mxnet/conv/graphconv.py
python/dgl/nn/mxnet/conv/graphconv.py
+1
-1
python/dgl/nn/mxnet/conv/nnconv.py
python/dgl/nn/mxnet/conv/nnconv.py
+1
-1
python/dgl/nn/mxnet/conv/sageconv.py
python/dgl/nn/mxnet/conv/sageconv.py
+1
-1
python/dgl/nn/pytorch/conv/dotgatconv.py
python/dgl/nn/pytorch/conv/dotgatconv.py
+1
-1
python/dgl/nn/pytorch/conv/edgeconv.py
python/dgl/nn/pytorch/conv/edgeconv.py
+1
-1
python/dgl/nn/pytorch/conv/gmmconv.py
python/dgl/nn/pytorch/conv/gmmconv.py
+1
-1
python/dgl/nn/pytorch/conv/nnconv.py
python/dgl/nn/pytorch/conv/nnconv.py
+1
-1
python/dgl/nn/pytorch/conv/sageconv.py
python/dgl/nn/pytorch/conv/sageconv.py
+1
-1
python/dgl/nn/tensorflow/conv/graphconv.py
python/dgl/nn/tensorflow/conv/graphconv.py
+1
-1
python/dgl/nn/tensorflow/conv/sageconv.py
python/dgl/nn/tensorflow/conv/sageconv.py
+1
-1
No files found.
python/dgl/convert.py
View file @
ab0c0ec6
...
...
@@ -10,20 +10,16 @@ from . import heterograph_index
from
.heterograph
import
DGLGraph
,
combine_frames
,
DGLBlock
from
.
import
graph_index
from
.
import
utils
from
.base
import
NTYPE
,
ETYPE
,
NID
,
EID
,
DGLError
,
dgl_warning
from
.base
import
NTYPE
,
ETYPE
,
NID
,
EID
,
DGLError
__all__
=
[
'graph'
,
'bipartite'
,
'hetero_from_relations'
,
'hetero_from_shared_memory'
,
'heterograph'
,
'create_block'
,
'block_to_graph'
,
'to_heterogeneous'
,
'to_hetero'
,
'to_homogeneous'
,
'to_homo'
,
'from_scipy'
,
'bipartite_from_scipy'
,
'from_networkx'
,
...
...
@@ -34,14 +30,12 @@ __all__ = [
]
def
graph
(
data
,
ntype
=
None
,
etype
=
None
,
*
,
num_nodes
=
None
,
idtype
=
None
,
device
=
None
,
row_sorted
=
False
,
col_sorted
=
False
,
**
deprecated_kwargs
):
col_sorted
=
False
):
"""Create a graph and return.
Parameters
...
...
@@ -67,10 +61,6 @@ def graph(data,
The tensors can be replaced with any iterable of integers (e.g. list, tuple,
numpy.ndarray).
ntype : str, optional
Deprecated. To construct a graph with named node types, use :func:`dgl.heterograph`.
etype : str, optional
Deprecated. To construct a graph with named edge types, use :func:`dgl.heterograph`.
num_nodes : int, optional
The number of nodes in the graph. If not given, this will be the largest node ID
plus 1 from the :attr:`data` argument. If given and the value is no greater than
...
...
@@ -156,14 +146,6 @@ def graph(data,
from_scipy
from_networkx
"""
# Deprecated arguments
if
ntype
is
not
None
:
raise
DGLError
(
'The ntype argument is deprecated for dgl.graph. To construct '
\
'a graph with named node types, use dgl.heterograph.'
)
if
etype
is
not
None
:
raise
DGLError
(
'The etype argument is deprecated for dgl.graph. To construct '
\
'a graph with named edge types, use dgl.heterograph.'
)
if
isinstance
(
data
,
spmatrix
):
raise
DGLError
(
"dgl.graph no longer supports graph construction from a SciPy "
"sparse matrix, use dgl.from_scipy instead."
)
...
...
@@ -172,12 +154,6 @@ def graph(data,
raise
DGLError
(
"dgl.graph no longer supports graph construction from a NetworkX "
"graph, use dgl.from_networkx instead."
)
if
len
(
deprecated_kwargs
)
!=
0
:
raise
DGLError
(
"Key word arguments {} have been removed from dgl.graph()."
" They are moved to dgl.from_scipy() and dgl.from_networkx()."
" Please refer to their API documents for more details."
.
format
(
deprecated_kwargs
.
keys
()))
(
sparse_fmt
,
arrays
),
urange
,
vrange
=
utils
.
graphdata2tensors
(
data
,
idtype
)
if
num_nodes
is
not
None
:
# override the number of nodes
if
num_nodes
<
max
(
urange
,
vrange
):
...
...
@@ -190,24 +166,6 @@ def graph(data,
return
g
.
to
(
device
)
def
bipartite
(
data
,
utype
=
'_U'
,
etype
=
'_E'
,
vtype
=
'_V'
,
num_nodes
=
None
,
card
=
None
,
validate
=
True
,
restrict_format
=
'any'
,
**
kwargs
):
"""DEPRECATED: use dgl.heterograph instead."""
raise
DGLError
(
'dgl.bipartite is deprecated. Use dgl.heterograph({'
+
"('{}', '{}', '{}')"
.
format
(
utype
,
etype
,
vtype
)
+
' : data} to create a bipartite graph instead.'
)
def
hetero_from_relations
(
rel_graphs
,
num_nodes_per_type
=
None
):
"""DEPRECATED: use dgl.heterograph instead."""
raise
DGLError
(
'dgl.hetero_from_relations is deprecated.
\n\n
'
'Use dgl.heterograph instead.'
)
def
hetero_from_shared_memory
(
name
):
"""Create a heterograph from shared memory with the given name.
...
...
@@ -826,16 +784,6 @@ def to_heterogeneous(G, ntypes, etypes, ntype_field=NTYPE,
return
hg
def
to_hetero
(
G
,
ntypes
,
etypes
,
ntype_field
=
NTYPE
,
etype_field
=
ETYPE
,
metagraph
=
None
):
"""Convert the given homogeneous graph to a heterogeneous graph.
DEPRECATED: Please use to_heterogeneous
"""
dgl_warning
(
"dgl.to_hetero is deprecated. Please use dgl.to_heterogeneous"
)
return
to_heterogeneous
(
G
,
ntypes
,
etypes
,
ntype_field
=
ntype_field
,
etype_field
=
etype_field
,
metagraph
=
metagraph
)
def
to_homogeneous
(
G
,
ndata
=
None
,
edata
=
None
,
store_type
=
True
,
return_count
=
False
):
"""Convert a heterogeneous graph to a homogeneous graph and return.
...
...
@@ -991,14 +939,6 @@ def to_homogeneous(G, ndata=None, edata=None, store_type=True, return_count=Fals
else
:
return
retg
def
to_homo
(
G
):
"""Convert the given heterogeneous graph to a homogeneous graph.
DEPRECATED: Please use to_homogeneous
"""
dgl_warning
(
"dgl.to_homo is deprecated. Please use dgl.to_homogeneous"
)
return
to_homogeneous
(
G
)
def
from_scipy
(
sp_mat
,
eweight_name
=
None
,
idtype
=
None
,
...
...
python/dgl/distributed/dist_graph.py
View file @
ab0c0ec6
...
...
@@ -652,7 +652,9 @@ class DistGraph:
--------
The following example uses PyTorch backend.
>>> g = dgl.bipartite(([0, 1, 1, 2], [0, 0, 2, 1]), 'user', 'plays', 'game')
>>> g = dgl.heterograph({
... ('user', 'plays', 'game'): ([0, 1, 1, 2], [0, 0, 2, 1])
... })
>>> print(g.device)
device(type='cpu')
>>> g = g.to('cuda:0')
...
...
python/dgl/nn/mxnet/conv/gmmconv.py
View file @
ab0c0ec6
...
...
@@ -93,7 +93,7 @@ class GMMConv(nn.Block):
>>> # Case 2: Unidirectional bipartite graph
>>> u = [0, 1, 0, 0, 1]
>>> v = [0, 1, 2, 3, 2]
>>> g = dgl.
bipartite(
(u, v))
>>> g = dgl.
heterograph({('_N', '_E', '_N'):
(u, v)
}
)
>>> u_fea = mx.nd.random.randn(2, 5)
>>> v_fea = mx.nd.random.randn(4, 10)
>>> pseudo = mx.nd.ones((5, 3))
...
...
python/dgl/nn/mxnet/conv/graphconv.py
View file @
ab0c0ec6
...
...
@@ -120,7 +120,7 @@ class GraphConv(gluon.Block):
>>> # Case 2: Unidirectional bipartite graph
>>> u = [0, 1, 0, 0, 1]
>>> v = [0, 1, 2, 3, 2]
>>> g = dgl.
bipartite(
(u, v))
>>> g = dgl.
heterograph({('_N', '_E', '_N'):
(u, v)
}
)
>>> u_fea = mx.nd.random.randn(2, 5)
>>> v_fea = mx.nd.random.randn(4, 5)
>>> conv = GraphConv(5, 2, norm='both', weight=True, bias=True)
...
...
python/dgl/nn/mxnet/conv/nnconv.py
View file @
ab0c0ec6
...
...
@@ -75,7 +75,7 @@ class NNConv(nn.Block):
>>> # Case 2: Unidirectional bipartite graph
>>> u = [0, 1, 0, 0, 1]
>>> v = [0, 1, 2, 3, 2]
>>> g = dgl.
bipartite(
(u, v))
>>> g = dgl.
heterograph({('_N', '_E', '_N'):
(u, v)
}
)
>>> u_feat = mx.nd.random.randn(2, 10)
>>> v_feat = mx.nd.random.randn(4, 10)
>>> conv = NNConv(10, 2, edge_func, 'mean')
...
...
python/dgl/nn/mxnet/conv/sageconv.py
View file @
ab0c0ec6
...
...
@@ -76,7 +76,7 @@ class SAGEConv(nn.Block):
>>> # Case 2: Unidirectional bipartite graph
>>> u = [0, 1, 0, 0, 1]
>>> v = [0, 1, 2, 3, 2]
>>> g = dgl.
bipartite(
(u, v))
>>> g = dgl.
heterograph({('_N', '_E', '_N'):
(u, v)
}
)
>>> u_fea = mx.nd.random.randn(2, 5)
>>> v_fea = mx.nd.random.randn(4, 10)
>>> conv = SAGEConv((5, 10), 2, 'pool')
...
...
python/dgl/nn/pytorch/conv/dotgatconv.py
View file @
ab0c0ec6
...
...
@@ -99,7 +99,7 @@ class DotGatConv(nn.Module):
>>> # Case 2: Unidirectional bipartite graph
>>> u = [0, 1, 0, 0, 1]
>>> v = [0, 1, 2, 3, 2]
>>> g = dgl.
bipartite(
(u, v))
>>> g = dgl.
heterograph({('_N', '_E', '_N'):
(u, v)
}
)
>>> u_feat = th.tensor(np.random.rand(2, 5).astype(np.float32))
>>> v_feat = th.tensor(np.random.rand(4, 10).astype(np.float32))
>>> dotgatconv = DotGatConv((5,10), 2, 3)
...
...
python/dgl/nn/pytorch/conv/edgeconv.py
View file @
ab0c0ec6
...
...
@@ -81,7 +81,7 @@ class EdgeConv(nn.Module):
>>> # Case 2: Unidirectional bipartite graph
>>> u = [0, 1, 0, 0, 1]
>>> v = [0, 1, 2, 3, 2]
>>> g = dgl.
bipartite(
(u, v))
>>> g = dgl.
heterograph({('_N', '_E', '_N'):
(u, v)
}
)
>>> u_fea = th.rand(2, 5)
>>> v_fea = th.rand(4, 5)
>>> conv = EdgeConv(5, 2, 3)
...
...
python/dgl/nn/pytorch/conv/gmmconv.py
View file @
ab0c0ec6
...
...
@@ -91,7 +91,7 @@ class GMMConv(nn.Module):
>>> # Case 2: Unidirectional bipartite graph
>>> u = [0, 1, 0, 0, 1]
>>> v = [0, 1, 2, 3, 2]
>>> g = dgl.
bipartite(
(u, v))
>>> g = dgl.
heterograph({('_N', '_E', '_N'):
(u, v)
}
)
>>> u_fea = th.rand(2, 5)
>>> v_fea = th.rand(4, 10)
>>> pseudo = th.ones(5, 3)
...
...
python/dgl/nn/pytorch/conv/nnconv.py
View file @
ab0c0ec6
...
...
@@ -72,7 +72,7 @@ class NNConv(nn.Module):
>>> # Case 2: Unidirectional bipartite graph
>>> u = [0, 1, 0, 0, 1]
>>> v = [0, 1, 2, 3, 2]
>>> g = dgl.
bipartite(
(u, v))
>>> g = dgl.
heterograph({('_N', '_E', '_N'):
(u, v)
}
)
>>> u_feat = th.tensor(np.random.rand(2, 10).astype(np.float32))
>>> v_feat = th.tensor(np.random.rand(4, 10).astype(np.float32))
>>> conv = NNConv(10, 2, edge_func, 'mean')
...
...
python/dgl/nn/pytorch/conv/sageconv.py
View file @
ab0c0ec6
...
...
@@ -83,7 +83,7 @@ class SAGEConv(nn.Module):
>>> # Case 2: Unidirectional bipartite graph
>>> u = [0, 1, 0, 0, 1]
>>> v = [0, 1, 2, 3, 2]
>>> g = dgl.
bipartite(
(u, v))
>>> g = dgl.
heterograph({('_N', '_E', '_N'):
(u, v)
}
)
>>> u_fea = th.rand(2, 5)
>>> v_fea = th.rand(4, 10)
>>> conv = SAGEConv((5, 10), 2, 'mean')
...
...
python/dgl/nn/tensorflow/conv/graphconv.py
View file @
ab0c0ec6
...
...
@@ -122,7 +122,7 @@ class GraphConv(layers.Layer):
>>> u = [0, 1, 0, 0, 1]
>>> v = [0, 1, 2, 3, 2]
>>> with tf.device("CPU:0"):
... g = dgl.
bipartite(
(u, v))
... g = dgl.
heterograph({('_N', '_E', '_N'):
(u, v)
}
)
... u_fea = tf.convert_to_tensor(np.random.rand(2, 5))
... v_fea = tf.convert_to_tensor(np.random.rand(4, 5))
... conv = GraphConv(5, 2, norm='both', weight=True, bias=True)
...
...
python/dgl/nn/tensorflow/conv/sageconv.py
View file @
ab0c0ec6
...
...
@@ -76,7 +76,7 @@ class SAGEConv(layers.Layer):
>>> with tf.device("CPU:0"):
>>> u = [0, 1, 0, 0, 1]
>>> v = [0, 1, 2, 3, 2]
>>> g = dgl.
bipartite(
(u, v))
>>> g = dgl.
heterograph({('_N', '_E', '_N'):
(u, v)
}
)
>>> u_fea = tf.convert_to_tensor(np.random.rand(2, 5))
>>> v_fea = tf.convert_to_tensor(np.random.rand(4, 5))
>>> conv = SAGEConv((5, 10), 2, 'mean')
...
...
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