nn.rst 1.4 KB
Newer Older
1
2
.. _guide-nn:

3
Chapter 3: Building GNN Modules
4
===============================
5

6
7
:ref:`(中文版) <guide_cn-nn>`

8
DGL NN module consists of building blocks for GNN models. An NN module inherits
9
from `Pytorch’s NN Module <https://pytorch.org/docs/1.2.0/_modules/torch/nn/modules/module.html>`__, `MXNet Gluon’s NN Block  <http://mxnet.incubator.apache.org/versions/1.6/api/python/docs/api/gluon/nn/index.html>`__ and `TensorFlow’s Keras
10
Layer <https://www.tensorflow.org/api_docs/python/tf/keras/layers>`__, depending on the DNN framework backend in use. In a DGL NN
11
12
13
14
15
16
17
module, the parameter registration in construction function and tensor
operation in forward function are the same with the backend framework.
In this way, DGL code can be seamlessly integrated into the backend
framework code. The major difference lies in the message passing
operations that are unique in DGL.

DGL has integrated many commonly used
18
:ref:`apinn-pytorch-conv`, :ref:`apinn-pytorch-dense-conv`, :ref:`apinn-pytorch-pooling`,
19
and
20
:ref:`apinn-pytorch-util`. We welcome your contribution!
21

22
23
This chapter takes :class:`~dgl.nn.pytorch.conv.SAGEConv` with Pytorch backend as an example
to introduce how to build a custom DGL NN Module.
24

25
26
Roadmap
-------
27

28
29
30
* :ref:`guide-nn-construction`
* :ref:`guide-nn-forward`
* :ref:`guide-nn-heterograph`
31

32
33
34
35
.. toctree::
    :maxdepth: 1
    :hidden:
    :glob:
36

37
38
39
    nn-construction
    nn-forward
    nn-heterograph