def grad(self, partial_derivative_opname=None): # TODO: Check the type of op to compute gradients result = 1 for op in self.ops: result *= op.grad(partial_derivative_opname) return result
def grad(self, partial_derivative_opname=None): result = 0 for op in self.ops: result += op.grad(partial_derivative_opname) return result