MCPcopy Create free account
hub / github.com/apache/singa / backward

Method backward

python/singa/autograd.py:1030–1046  ·  view source on GitHub ↗

Args: dy (CTensor): dL / dy Returns: dx (CTensor): dL / dx

(self, dy)

Source from the content-addressed store, hash-verified

1028 return x1
1029
1030 def backward(self, dy):
1031 """
1032 Args:
1033 dy (CTensor): dL / dy
1034 Returns:
1035 dx (CTensor): dL / dx
1036 """
1037 dx1mask = singa.LEFloat(self.input, 0.0)
1038 dx1 = singa.MultFloat(singa.Exp(self.input), self.gamma * self.alpha)
1039 dx1 = singa.__mul__(dx1mask, dx1)
1040
1041 dx2mask = singa.GTFloat(self.input, 0.0)
1042 dx2 = singa.MultFloat(dx2mask, self.gamma)
1043
1044 dx = singa.__add__(dx1, dx2)
1045 dx *= dy
1046 return dx
1047
1048
1049def selu(x, alpha=1.67326, gamma=1.0507):

Callers

nothing calls this directly

Calls 2

__mul__Method · 0.45
__add__Method · 0.45

Tested by

no test coverage detected