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

Function _edge_softmax_backward

python/dgl/_sparse_ops.py:90–120  ·  view source on GitHub ↗

r"""Edge_softmax backward interface. Parameters ---------- gidx : HeteroGraphIndex The input graph index. out : tensor The result of Edge_softmax during forward. sds : tensor The result of out * gradient. Returns ------- The result of Edge_so

(gidx, out, sds)

Source from the content-addressed store, hash-verified

88
89
90def _edge_softmax_backward(gidx, out, sds):
91 r"""Edge_softmax backward interface.
92
93 Parameters
94 ----------
95 gidx : HeteroGraphIndex
96 The input graph index.
97 out : tensor
98 The result of Edge_softmax during forward.
99 sds : tensor
100 The result of out * gradient.
101
102 Returns
103 -------
104 The result of Edge_softmax during backward
105
106 Notes
107 -----
108 This function does not support gpu op.
109 """
110 op = "copy_rhs"
111 back_out = F.zeros_like(out)
112 _CAPI_DGLKernelEdge_softmax_backward(
113 gidx,
114 op,
115 to_dgl_nd(out),
116 to_dgl_nd(sds),
117 to_dgl_nd_for_write(back_out),
118 to_dgl_nd(None),
119 )
120 return back_out
121
122
123def _edge_softmax_forward(gidx, e, op):

Callers 1

backwardMethod · 0.85

Calls 2

to_dgl_nd_for_writeFunction · 0.85
to_dgl_ndFunction · 0.70

Tested by

no test coverage detected