Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backends/cadence/aot/ref_implementations.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ def variant(
if out_shift.numel() != 1:
raise ValueError("out_shift must be a scalar")

if out_shift.dtype != torch.int64:
raise ValueError("out_shift must be an int64")
if out_shift.dtype != torch.int32:
raise ValueError("out_shift must be an int32")

_out_shift = int(out_shift.item())
_out_multiplier = int(out_multiplier[0].item())
Expand Down
16 changes: 8 additions & 8 deletions backends/cadence/aot/tests/test_ref_implementations.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def test_quantized_add(
torch.tensor(
[1073741824], dtype=torch.int32
), # out_multiplier (0.5 * 2^31)
torch.tensor([0], dtype=torch.int64), # out_shift
torch.tensor([0], dtype=torch.int32), # out_shift
0, # out_zero_point
torch.tensor([[0]], dtype=dtype), # expected_output
per_tensor,
Expand All @@ -197,7 +197,7 @@ def test_quantized_add(
torch.tensor(
[1073741824], dtype=torch.int32
), # out_multiplier (0.5 * 2^31)
torch.tensor([0], dtype=torch.int64), # out_shift
torch.tensor([0], dtype=torch.int32), # out_shift
0, # out_zero_point
torch.tensor([[-2, -8]], dtype=dtype), # expected_output
per_tensor,
Expand All @@ -220,7 +220,7 @@ def test_quantized_add(
torch.tensor(
[1073741824], dtype=torch.int32
), # out_multiplier (0.5 * 2^31)
torch.tensor([0], dtype=torch.int64), # out_shift
torch.tensor([0], dtype=torch.int32), # out_shift
0, # out_zero_point
torch.tensor([[0, 0]], dtype=dtype), # expected_output
per_tensor,
Expand All @@ -244,7 +244,7 @@ def test_quantized_add(
torch.tensor(
[1073741824], dtype=torch.int32
), # out_multiplier (0.5 * 2^31)
torch.tensor([0], dtype=torch.int64), # out_shift
torch.tensor([0], dtype=torch.int32), # out_shift
0, # out_zero_point
torch.tensor(
[[[0, -2, -4], [-2, -7, -12]]], dtype=dtype
Expand All @@ -270,7 +270,7 @@ def test_quantized_add(
torch.tensor(
[268435456], dtype=torch.int32
), # out_multiplier (1.0 * 2^31)
torch.tensor([0], dtype=torch.int64), # out_shift
torch.tensor([0], dtype=torch.int32), # out_shift
1, # out_zero_point
torch.tensor([[1, 1]], dtype=dtype), # expected_output
per_tensor,
Expand All @@ -295,7 +295,7 @@ def test_quantized_add(
torch.tensor(
[268435456], dtype=torch.int32
), # out_multiplier (1.0 * 2^31)
torch.tensor([0], dtype=torch.int64), # out_shift
torch.tensor([0], dtype=torch.int32), # out_shift
1, # out_zero_point
torch.tensor([[1, 1]], dtype=dtype), # expected_output
False,
Expand All @@ -317,7 +317,7 @@ def test_quantized_add(
[268435456], dtype=torch.int32
), # out_multiplier (0.125 * 2^31)
torch.tensor(
[1], dtype=torch.int64
[1], dtype=torch.int32
), # out_shift (shift=1, doubles the scale)
1, # out_zero_point
torch.tensor([[1, 2]], dtype=dtype), # expected_output
Expand All @@ -339,7 +339,7 @@ def test_quantized_add(
[268435456], dtype=torch.int32
), # out_multiplier (0.125 * 2^31)
torch.tensor(
[1], dtype=torch.int64
[1], dtype=torch.int32
), # out_shift (shift=1, doubles the scale)
1, # out_zero_point
torch.tensor([[1, 2]], dtype=dtype), # expected_output
Expand Down
Loading