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

Method backward

python/singa/autograd.py:1941–1952  ·  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

1939 return out
1940
1941 def backward(self, dy):
1942 """
1943 Args:
1944 dy (CTensor): the gradient tensor from upper operations
1945 Returns:
1946 CTensor, the gradient over input
1947 """
1948 dx = singa.__mul__(self.cache[0], self.cache[0])
1949 dx = singa.MultFloat(dx, -1.0)
1950 dx = singa.AddFloat(dx, 1.0)
1951 dx *= dy
1952 return dx
1953
1954
1955def tanh(x):

Callers

nothing calls this directly

Calls 1

__mul__Method · 0.45

Tested by

no test coverage detected