Skip to content

Commit 6b19229

Browse files
committed
Pass debug flags to NeutronConverter
1 parent 4012888 commit 6b19229

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

backends/nxp/backend/ir/converter/node_converters/ops_converters/relu_converter.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ def supports_partitioning_result(
4343
node, partition_list, filter_fn=is_not_qdq_node
4444
)
4545
if is_alone_in_partition:
46-
return activation_supported_on_target(node, neutron_target_spec)
46+
neutron_c = getattr(
47+
custom_delegation_options, "use_new_flow_neutron_c", False
48+
)
49+
return activation_supported_on_target(
50+
node, neutron_target_spec, use_new_flow_neutron_c=neutron_c
51+
)
4752

4853
return True
4954

backends/nxp/tests/ir/converter/node_converter/test_relu_converter.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import numpy as np
77
import pytest
88
import torch
9-
109
from executorch.backends.nxp.backend.edge_program_converter import (
1110
EdgeProgramToIRConverter,
1211
exir_ops,
@@ -21,7 +20,9 @@
2120
ToNCHWPreprocess,
2221
ToNHWCPreprocess,
2322
)
23+
from executorch.backends.nxp.tests.graph_verifier import BaseGraphVerifier
2424
from executorch.backends.nxp.tests.models import Conv2dModule, LinearModule, ReLUModule
25+
from executorch.backends.nxp.tests.nsys_testing import lower_run_compare
2526
from torch.export import ExportedProgram
2627
from executorch.backends.nxp.tests.use_qat import * # noqa F403
2728

@@ -146,3 +147,21 @@ def test_relu_conversion__unsupported(mocker, input_shape):
146147
# Make sure the `relu` was NOT delegated.
147148
assert not graph_contains_any_of_ops(delegated_ep.graph, [ExecutorchDelegateCall])
148149
assert graph_contains_any_of_ops(delegated_ep.graph, [ReLU])
150+
151+
152+
@pytest.mark.parametrize(
153+
"input_shape",
154+
[
155+
pytest.param(
156+
(3, 9, 7), id="num_channels not divisible by NUM_MACS, alone in partition"
157+
),
158+
],
159+
)
160+
def test_relu_conversion__new_flow_support(mocker, input_shape):
161+
model = ReLUModule()
162+
graph_verifier = BaseGraphVerifier(
163+
exp_num_delegate_call_nodes=1, # Delegated AvgPool.
164+
exp_non_delegated_nodes=[],
165+
)
166+
167+
lower_run_compare(model, input_shape, graph_verifier, use_new_flow_neutron_c=True)

0 commit comments

Comments
 (0)