Args: dy (CTensor): the gradient tensor from upper operations Returns: CTensor, the gradient over input
(self, dy)
| 2117 | return singa.Acosh(x) |
| 2118 | |
| 2119 | def backward(self, dy): |
| 2120 | """ |
| 2121 | Args: |
| 2122 | dy (CTensor): the gradient tensor from upper operations |
| 2123 | Returns: |
| 2124 | CTensor, the gradient over input |
| 2125 | """ |
| 2126 | dx = singa.SubFloat(self.input, 1.0) |
| 2127 | dx = singa.Sqrt(dx) |
| 2128 | temp = singa.AddFloat(self.input, 1.0) |
| 2129 | temp = singa.Sqrt(temp) |
| 2130 | dx = singa.__mul__(dx, temp) |
| 2131 | dx = singa.PowFloat(dx, -1.0) |
| 2132 | dx *= dy |
| 2133 | return dx |
| 2134 | |
| 2135 | |
| 2136 | def acosh(x): |