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

Method backward

python/singa/autograd.py:2760–2773  ·  view source on GitHub ↗

Args: dy (CTensor): the gradient tensor from upper operations Returns: CTensor, the gradient over input

(self, dy)

Source from the content-addressed store, hash-verified

2758 return x1
2759
2760 def backward(self, dy):
2761 """
2762 Args:
2763 dy (CTensor): the gradient tensor from upper operations
2764 Returns:
2765 CTensor, the gradient over input
2766 """
2767 # TODO(wangwei) check the correctness
2768 dx1 = singa.GTFloat(self.input, 0.0)
2769 dx2 = singa.LTFloat(self.input, 0.0)
2770 dx2 = singa.MultFloat(dx2, self.a)
2771 dx = singa.__add__(dx1, dx2)
2772 dx *= dy
2773 return dx
2774
2775
2776def leakyrelu(x, a=0.01):

Callers

nothing calls this directly

Calls 1

__add__Method · 0.45

Tested by

no test coverage detected