def backward(self, indexes, grad_outputs): gy = grad_outputs[0] axis = self.axis if axis is not None: gx = flip.flip(cumprod(flip.flip(gy, axis), axis), axis) else: gx = flip.flip(cumprod(flip.flip(gy, 0), 0), 0) gx = gx.reshape(self._in_shape) return gx,
def backward(self, indexes, grad_outputs): gy = grad_outputs[0] axis = self.axis if axis is not None: gx = flip.flip(cumsum(flip.flip(gy, axis), axis), axis) else: gx = flip.flip(cumsum(flip.flip(gy, 0), 0), 0) gx = gx.reshape(self._in_shape) return gx,
def _flipcumprodsum(xmul, xadd, axis): z, = Cumprodsum(axis).apply((flip.flip(xmul, axis), flip.flip(xadd, axis))) return flip.flip(z, axis)
def _flipcumprodsum(xmul, xadd, axis): z, = Cumprodsum(axis).apply((flip.flip(xmul, axis), flip.flip(xadd, axis))) return flip.flip(z, axis)