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

Method forward

python/singa/autograd.py:3182–3198  ·  view source on GitHub ↗

Args: x (CTensor): matrix Returns: a CTensor for the result

(self, x)

Source from the content-addressed store, hash-verified

3180 self.gamma = gamma
3181
3182 def forward(self, x):
3183 """
3184 Args:
3185 x (CTensor): matrix
3186 Returns:
3187 a CTensor for the result
3188 """
3189 x = singa.AddFloat(singa.MultFloat(x, self.alpha), self.gamma)
3190 if training:
3191 self.cache = x
3192
3193 x = singa.ReLU(x)
3194 mask1 = singa.LTFloat(x, 1.0)
3195 mask2 = singa.GEFloat(x, 1.0)
3196
3197 ans = singa.__add__(singa.__mul__(x, mask1), mask2)
3198 return singa.ReLU(ans)
3199
3200 def backward(self, dy):
3201 """

Callers

nothing calls this directly

Calls 2

__add__Method · 0.45
__mul__Method · 0.45

Tested by

no test coverage detected