MCPcopy
hub / github.com/dmlc/dgl / update

Method update

python/dgl/optim/pytorch/sparse_optim.py:436–449  ·  view source on GitHub ↗

Update embeddings in a sparse manner Sparse embeddings are updated in mini batches. We maintain gradient states for each embedding so they can be updated separately. Parameters ---------- idx : tensor Index of the embeddings to be updated.

(self, idx, grad, emb)

Source from the content-addressed store, hash-verified

434
435 @abstractmethod
436 def update(self, idx, grad, emb):
437 """Update embeddings in a sparse manner
438 Sparse embeddings are updated in mini batches. We maintain gradient states for
439 each embedding so they can be updated separately.
440
441 Parameters
442 ----------
443 idx : tensor
444 Index of the embeddings to be updated.
445 grad : tensor
446 Gradient of each embedding.
447 emb : dgl.nn.NodeEmbedding
448 Sparse node embedding to update.
449 """
450
451 def zero_grad(self):
452 """clean grad cache"""

Callers 2

_comm_stepMethod · 0.95
_shared_stepMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected