-
Notifications
You must be signed in to change notification settings - Fork 613
NXP backend: Add quantization of aten.view #11784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,13 +7,7 @@ | |
import pytest | ||
import torch | ||
|
||
from executorch.backends.nxp.backend.edge_program_converter import ( | ||
EdgeProgramToIRConverter, | ||
) | ||
from executorch.backends.nxp.tests.executorch_pipeline import ( | ||
to_edge_program, | ||
to_quantized_edge_program, | ||
) | ||
from executorch.backends.nxp.tests.executorch_pipeline import to_edge_program | ||
from executorch.backends.nxp.tests.executors import ( | ||
convert_run_compare, | ||
ToNCHWPreprocess, | ||
|
@@ -22,9 +16,7 @@ | |
from executorch.backends.nxp.tests.models import ( | ||
ConstantPadNDConvModule, | ||
ConstantPadNDModule, | ||
Conv2dConstantPadNDModule, | ||
) | ||
from torch.export import ExportedProgram | ||
|
||
|
||
@pytest.fixture(autouse=True) | ||
|
@@ -47,37 +39,6 @@ def test_constant_pad_nd_conversion__specific_constant(constant): | |
convert_run_compare(edge_program, input_data) | ||
|
||
|
||
@pytest.mark.parametrize("constant", [0.0, 67.28, 42.0, -13.37]) | ||
@pytest.mark.skip(reason="Neutron Converter does not fully convert for NPU") | ||
def test_constant_pad_nd_quant_conversion__specific_constant(mocker, constant): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unrelated change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are right, this should have been a separate PR to remove irrelevant test. We will pay more attention when rebasing from our development tree. |
||
input_shape = (2, 4, 12, 12) | ||
paddings = (2, 2, 2, 2) | ||
|
||
converter_spy = mocker.spy(EdgeProgramToIRConverter, "convert_program") | ||
|
||
# Run conversion | ||
_ = to_quantized_edge_program( | ||
Conv2dConstantPadNDModule(paddings, constant), input_shape | ||
) | ||
|
||
# Capture generated model | ||
tflite_flatbuffers_model, io_formats = converter_spy.spy_return | ||
|
||
# Capture converted program | ||
edge_program: ExportedProgram = converter_spy.call_args.args[1] | ||
|
||
input_data = (np.random.random(input_shape).astype(np.float32) * 50).astype(np.int8) | ||
|
||
convert_run_compare( | ||
edge_program, | ||
input_data, | ||
tfl_model=tflite_flatbuffers_model, | ||
atol=1.0, | ||
tflite_input_preprocess=ToNHWCPreprocess(), | ||
tflite_output_preprocess=ToNCHWPreprocess(), | ||
) | ||
|
||
|
||
def test_constant_pad_nd_conversion__default_constant(): | ||
input_shape = [2, 4, 6, 8] | ||
paddings = [1, 2, 3, 4] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this related to the view support?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, not related to aten.view. Our fault.
It is indeed a separate commit, and the PR descrition should have included the proper description:
"Fix avegage pooling, which in case of kernel (1,1) turns into Sum in Neutron IR"
At least added in to the PR description.