From 3a23169b1019981315ee06a0bfbec5e286348cb0 Mon Sep 17 00:00:00 2001 From: Nikita Savelyev Date: Fri, 1 Nov 2024 17:30:22 +0100 Subject: [PATCH] Invert Tensor division for __truediv__ and __rtruediv__ --- nncf/tensor/tensor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nncf/tensor/tensor.py b/nncf/tensor/tensor.py index 9edbd4acb50..dfaa1f19cf7 100644 --- a/nncf/tensor/tensor.py +++ b/nncf/tensor/tensor.py @@ -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)