-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix in-place processing error in quant_weight function (#1703)
Signed-off-by: xin3he <[email protected]> Signed-off-by: Cheng, Penghui <[email protected]>
- Loading branch information
Showing
3 changed files
with
40 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import pytest | ||
import torch | ||
|
||
|
||
@pytest.mark.parametrize("shape", [1024, 512, 300]) | ||
def test_quant_tensor_id(shape): | ||
from neural_compressor.torch.algorithms.weight_only.utility import quant_tensor | ||
|
||
input = torch.randn(shape, shape) | ||
id1 = id(input) | ||
output = quant_tensor(input) | ||
id2 = id(output) | ||
assert id1 == id2, "quant_tensor function is an in-place operator" |