Skip to content

Commit

Permalink
[Doc] Fix docs for sparse optimizer (dmlc#2680)
Browse files Browse the repository at this point in the history
Co-authored-by: Ubuntu <[email protected]>
Co-authored-by: Minjie Wang <[email protected]>
  • Loading branch information
3 people authored Feb 19, 2021
1 parent 9e04a52 commit 453d358
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions docs/source/api/python/nn.pytorch.rst
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@ SegmentedKNNGraph
:members:
:show-inheritance:

NodeEmbedding Module
----------------------------------------

NodeEmbedding
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ Getting Started
api/python/dgl.function
api/python/nn
api/python/dgl.ops
api/python/dgl.optim
api/python/dgl.sampling
api/python/udf

Expand Down
2 changes: 2 additions & 0 deletions python/dgl/nn/pytorch/sparse_emb.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class NodeEmbedding: # NodeEmbedding
``torch.distributed.TCPStore`` to share meta-data information across multiple gpu processes.
It use the local address of '127.0.0.1:12346' to initialize the TCPStore.
NOTE: The support of NodeEmbedding is experimental.
Parameters
----------
num_embeddings : int
Expand Down
2 changes: 1 addition & 1 deletion python/dgl/optim/pytorch/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""dgl optims for pytorch."""
"""dgl sparse optimizer for pytorch."""
from .sparse_optim import SparseAdagrad, SparseAdam
8 changes: 6 additions & 2 deletions python/dgl/optim/pytorch/sparse_optim.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ class SparseAdagrad(SparseGradOptimizer):
:math:`G_{t,i,j}=G_{t-1,i,j} + g_{t,i,j}^2` and :math:`g_{t,i,j}` is the gradient of
the dimension :math:`j` of embedding :math:`i` at step :math:`t`.
NOTE: The support of sparse Adagrad optimizer is experimental.
Parameters
----------
params : list[dgl.nn.NodeEmbedding]
Expand Down Expand Up @@ -335,6 +337,8 @@ class SparseAdam(SparseGradOptimizer):
:math:`g_{t,i,j}` is the gradient of the dimension :math:`j` of embedding :math:`i`
at step :math:`t`.
NOTE: The support of sparse Adam optimizer is experimental.
Parameters
----------
params : list[dgl.nn.NodeEmbedding]
Expand All @@ -348,8 +352,8 @@ class SparseAdam(SparseGradOptimizer):
The term added to the denominator to improve numerical stability
Default: 1e-8
Examples:
Examples
--------
>>> def initializer(emb):
th.nn.init.xavier_uniform_(emb)
return emb
Expand Down

0 comments on commit 453d358

Please sign in to comment.