Skip to content
Open
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
1 change: 1 addition & 0 deletions backends/xnnpack/quantizer/xnnpack_quantizer_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,7 @@ def _is_share_obs_or_fq_op(op: Callable) -> bool:
torch.ops.aten.view_copy.default,
torch.ops.aten.view.default,
torch.ops.aten.reshape.default,
torch.ops.aten.slice.Tensor,
torch.ops.aten.slice_copy.Tensor,
torch.ops.aten.flatten.using_ints,
]
Expand Down
12 changes: 6 additions & 6 deletions backends/xnnpack/test/ops/test_slice_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,9 @@ def forward(self, x):
.check_not(["torch.ops.higher_order.executorch_call_delegate"])
)

# Note: Slice ends up as slice_copy later in the process, but during quantization,
# it's still slice, which isn't supported by the XNNPACK quantizer.
@unittest.skip("T156004676 - slice isn't propagated")
def _test_qs8_slice_copy(self):
# Note: Slice ends up as slice_copy later in the process, but during quantization
# it's still slice, so the quantizer shares observers on aten.slice.Tensor.
def test_qs8_slice_copy(self):
class SliceCopy(torch.nn.Module):
def forward(self, x):
y = x + x
Expand All @@ -157,8 +156,9 @@ def forward(self, x):
.export()
.check_node_count(
{
"aten::slice.Tensor": 3,
"quantized_decomposed::quantize_per_tensor": 3,
torch.ops.aten.slice.Tensor: 3,
# 3 slices, plus the input and the add output
torch.ops.quantized_decomposed.quantize_per_tensor.default: 5,
}
)
.to_edge_transform_and_lower()
Expand Down
Loading