diff --git a/python/needle/autograd.py b/python/needle/autograd.py index 60ea47a..50ba4bc 100755 --- a/python/needle/autograd.py +++ b/python/needle/autograd.py @@ -360,8 +360,9 @@ def transpose(self, axes=None): __radd__ = __add__ __rmul__ = __mul__ - __rsub__ = __sub__ __rmatmul__ = __matmul__ + def __rsub__(self, other): + return other + (-self) def compute_gradient_of_variables(output_tensor, out_grad):