Unverified Commit 3132da28 authored by peizhou001's avatar peizhou001 Committed by GitHub
Browse files

Deprecate (#4864)

rename DGLHeteroGraph to DGLGraph
parent ee9887d6
......@@ -133,7 +133,7 @@ class WeightedSAGEConv(nn.Module):
class SAGENet(nn.Module):
def __init__(self, hidden_dims, n_layers):
"""
g : DGLHeteroGraph
g : DGLGraph
The user-item interaction graph.
This is only for finding the range of categorical variables.
item_textsets : torchtext.data.Dataset
......@@ -357,7 +357,7 @@ def assign_textual_node_features(ndata, textset, ntype):
The length would be stored as another node feature with name
``field_name + '__len'``.
block : DGLHeteroGraph
block : DGLGraph
First element of the compacted blocks, with "dgl.NID" as the
corresponding node ID in the original graph, hence the index to the
text dataset.
......
......@@ -88,7 +88,7 @@ class RelGraphConvLayer(nn.Module):
Parameters
----------
g : DGLHeteroGraph
g : DGLGraph
Input graph.
inputs : dict[str, torch.Tensor]
Node feature for each node type.
......@@ -164,14 +164,14 @@ class RelGraphEmbed(nn.Module):
Parameters
----------
block : DGLHeteroGraph, optional
block : DGLGraph, optional
If not specified, directly return the full graph with embeddings stored in
:attr:`embed_name`. Otherwise, extract and store the embeddings to the block
graph and return.
Returns
-------
DGLHeteroGraph
DGLGraph
The block graph fed with embeddings.
"""
embeds = {}
......
......@@ -67,8 +67,6 @@ Operators for generating new graphs by manipulating the structure of the existin
add_self_loop
adj_product_graph
adj_sum_graph
as_heterograph
as_immutable_graph
compact_graphs
khop_adj
khop_graph
......
......@@ -28,7 +28,7 @@ def get_graph(network_data, vocab):
mapping node IDs to node indices
Output
------
DGLHeteroGraph
DGLGraph
a heterogenous graph, with one node type and different edge types
"""
graphs = []
......
......@@ -28,7 +28,7 @@ def get_graph(network_data, vocab):
mapping node IDs to node indices
Output
------
DGLHeteroGraph
DGLGraph
a heterogenous graph, with one node type and different edge types
"""
graphs = []
......
......@@ -39,7 +39,7 @@ def get_graph(network_data, vocab):
mapping node IDs to node indices
Output
------
DGLHeteroGraph
DGLGraph
a heterogenous graph, with one node type and different edge types
"""
graphs = []
......
......@@ -46,25 +46,25 @@ class MovieLens(object):
Attributes
----------
train_enc_graph : dgl.DGLHeteroGraph
train_enc_graph : dgl.DGLGraph
Encoder graph for training.
train_dec_graph : dgl.DGLHeteroGraph
train_dec_graph : dgl.DGLGraph
Decoder graph for training.
train_labels : torch.Tensor
The categorical label of each user-movie pair
train_truths : torch.Tensor
The actual rating values of each user-movie pair
valid_enc_graph : dgl.DGLHeteroGraph
valid_enc_graph : dgl.DGLGraph
Encoder graph for validation.
valid_dec_graph : dgl.DGLHeteroGraph
valid_dec_graph : dgl.DGLGraph
Decoder graph for validation.
valid_labels : torch.Tensor
The categorical label of each user-movie pair
valid_truths : torch.Tensor
The actual rating values of each user-movie pair
test_enc_graph : dgl.DGLHeteroGraph
test_enc_graph : dgl.DGLGraph
Encoder graph for test.
test_dec_graph : dgl.DGLHeteroGraph
test_dec_graph : dgl.DGLGraph
Decoder graph for test.
test_labels : torch.Tensor
The categorical label of each user-movie pair
......
......@@ -233,7 +233,7 @@ class GCMCLayer(nn.Module):
Parameters
----------
graph : DGLHeteroGraph
graph : DGLGraph
User-movie rating graph. It should contain two node types: "user"
and "movie" and many edge types each for one rating value.
ufeat : torch.Tensor, optional
......@@ -320,7 +320,7 @@ class BiDecoder(nn.Module):
Parameters
----------
graph : DGLHeteroGraph
graph : DGLGraph
"Flattened" user-movie graph with only one edge type.
ufeat : th.Tensor
User embeddings. Shape: (|V_u|, D)
......
......@@ -47,7 +47,7 @@ class HANLayer(nn.Module):
Inputs
------
g : DGLHeteroGraph
g : DGLGraph
The heterogeneous graph
h : tensor
Input features
......
......@@ -34,7 +34,7 @@ class HANLayer(torch.nn.Module):
Inputs
------
g : DGLHeteroGraph
g : DGLGraph
The heterogeneous graph
h : tensor
Input features
......
......@@ -469,7 +469,7 @@ def doc_subgraph(G, doc_ids):
_, _, (block,) = sampler.sample(
G.reverse(), {"doc": torch.as_tensor(doc_ids)}
)
B = dgl.DGLHeteroGraph(
B = dgl.DGLGraph(
block._graph, ["_", "word", "doc", "_"], block.etypes
).reverse()
B.nodes["word"].data["_ID"] = block.nodes["word"].data["_ID"]
......
......@@ -113,7 +113,7 @@ class RelGraphConvLayer(nn.Module):
"""
Parameters
----------
g : DGLHeteroGraph
g : DGLGraph
Input graph.
inputs : dict[str, torch.Tensor]
Node feature for each node type.
......
......@@ -136,7 +136,7 @@ class WeightedSAGEConv(nn.Module):
class SAGENet(nn.Module):
def __init__(self, hidden_dims, n_layers):
"""
g : DGLHeteroGraph
g : DGLGraph
The user-item interaction graph.
This is only for finding the range of categorical variables.
item_textsets : torchtext.data.Dataset
......
......@@ -147,7 +147,7 @@ def assign_textual_node_features(ndata, textset, ntype):
The length would be stored as another node feature with name
``field_name + '__len'``.
block : DGLHeteroGraph
block : DGLGraph
First element of the compacted blocks, with "dgl.NID" as the
corresponding node ID in the original graph, hence the index to the
text dataset.
......
......@@ -101,7 +101,7 @@ class RelGraphConvLayer(nn.Module):
Parameters
----------
g : DGLHeteroGraph
g : DGLGraph
Input graph.
inputs : dict[str, torch.Tensor]
Node feature for each node type.
......@@ -224,7 +224,7 @@ class RelGraphConvLayerHeteroAPI(nn.Module):
Parameters
----------
g : DGLHeteroGraph
g : DGLGraph
Input graph.
inputs : dict[str, torch.Tensor]
Node feature for each node type.
......@@ -302,14 +302,14 @@ class RelGraphEmbed(nn.Module):
Parameters
----------
block : DGLHeteroGraph, optional
block : DGLGraph, optional
If not specified, directly return the full graph with embeddings stored in
:attr:`embed_name`. Otherwise, extract and store the embeddings to the block
graph and return.
Returns
-------
DGLHeteroGraph
DGLGraph
The block graph fed with embeddings.
"""
return self.embeds
......
......@@ -105,7 +105,7 @@ class RelGraphConvLayer(nn.Module):
"""Forward computation
Parameters
----------
g : DGLHeteroGraph
g : DGLGraph
Input graph.
inputs : dict[str, torch.Tensor]
Node feature for each node type.
......
......@@ -36,8 +36,8 @@ from .readout import *
from .batch import *
from .convert import *
from .generators import *
from .heterograph import DGLHeteroGraph
from .heterograph import DGLHeteroGraph as DGLGraph # pylint: disable=reimported
from .heterograph import DGLGraph
from .heterograph import DGLGraph as DGLHeteroGraph # pylint: disable=reimported
from .dataloading import set_src_lazy_features, set_dst_lazy_features, set_edge_lazy_features, \
set_node_lazy_features
from .merge import *
......
......@@ -10,7 +10,7 @@ from .. import backend as F
from .. import utils
from ..batch import batch
from ..convert import heterograph
from ..heterograph import DGLHeteroGraph as DGLGraph
from ..heterograph import DGLGraph
from ..distributed.dist_graph import DistGraph
from ..utils import to_device
......
......@@ -40,7 +40,7 @@ class DGLBaseGraph(object):
Data to initialize graph.
"""
is_block = False # for compatibility with DGLHeteroGraph
is_block = False # for compatibility with DGLGraph
def __init__(self, graph):
self._graph = graph
......
......@@ -4,12 +4,12 @@ from collections.abc import Mapping
from . import backend as F
from .base import ALL, is_all, DGLError, dgl_warning, NID, EID
from .heterograph_index import disjoint_union, slice_gidx
from .heterograph import DGLHeteroGraph
from .heterograph import DGLGraph
from . import convert
from . import utils
__all__ = ['batch', 'unbatch', 'slice_batch', 'batch_hetero', 'unbatch_hetero']
__all__ = ['batch', 'unbatch', 'slice_batch']
def batch(graphs, ndata=ALL, edata=ALL, *,
node_attrs=None, edge_attrs=None):
......@@ -175,7 +175,7 @@ def batch(graphs, ndata=ALL, edata=ALL, *,
etypes = [etype for _, etype, _ in relations]
gidx = disjoint_union(graphs[0]._graph.metagraph, [g._graph for g in graphs])
retg = DGLHeteroGraph(gidx, ntypes, etypes)
retg = DGLGraph(gidx, ntypes, etypes)
# Compute batch num nodes
bnn = {}
......@@ -479,7 +479,7 @@ def slice_batch(g, gid, store_ids=False):
# Slice graph structure
gidx = slice_gidx(g._graph, utils.toindex(num_nodes), utils.toindex(start_nid),
utils.toindex(num_edges), utils.toindex(start_eid))
retg = DGLHeteroGraph(gidx, g.ntypes, g.etypes)
retg = DGLGraph(gidx, g.ntypes, g.etypes)
# Slice node features
for ntid, ntype in enumerate(g.ntypes):
......@@ -504,16 +504,3 @@ def slice_batch(g, gid, store_ids=False):
retg.idtype, retg.device)
return retg
#### DEPRECATED APIS ####
def batch_hetero(*args, **kwargs):
"""DEPREACTED: please use dgl.batch """
dgl_warning('From v0.5, DGLHeteroGraph is merged into DGLGraph. You can safely'
' replace dgl.batch_hetero with dgl.batch')
return batch(*args, **kwargs)
def unbatch_hetero(*args, **kwargs):
"""DEPREACTED: please use dgl.unbatch """
dgl_warning('From v0.5, DGLHeteroGraph is merged into DGLGraph. You can safely'
' replace dgl.unbatch_hetero with dgl.unbatch')
return unbatch(*args, **kwargs)
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