Skip to content

Commit

Permalink
Invert Tensor division for __truediv__ and __rtruediv__
Browse files Browse the repository at this point in the history
  • Loading branch information
nikita-savelyevv committed Nov 1, 2024
1 parent 3ba9b06 commit 9cf712c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nncf/tensor/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ def __ipow__(self, other: Union[Tensor, float]) -> Tensor:
return self

def __truediv__(self, other: Union[Tensor, float]) -> Tensor:
return _call_function("_binary_op_nowarn", self, other, operator.truediv)
return self * _call_function("_binary_op_nowarn", 1.0, other, operator.truediv)

def __rtruediv__(self, other: Union[Tensor, float]) -> Tensor:
return _call_function("_binary_reverse_op_nowarn", self, other, operator.truediv)
return other * _call_function("_binary_reverse_op_nowarn", self, 1.0, operator.truediv)

def __itruediv__(self, other: Union[Tensor, float]) -> Tensor:
self._data /= unwrap_tensor_data(other)
Expand Down

0 comments on commit 9cf712c

Please sign in to comment.