Skip to content

Commit c92249c

Browse files
mcr229facebook-github-bot
authored andcommitted
quant params from static inputs
Differential Revision: https://internalfb.com/D49850149 fbshipit-source-id: 7add20e4367df6f51226975114ca22e57b9d4be5
1 parent 8b0fc05 commit c92249c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

backends/xnnpack/operators/quant_params.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
import torch
1212
from executorch.backends.xnnpack.passes.tag_implicit_q_dq_pass import TagImplicitQDqPass
1313
from executorch.backends.xnnpack.utils.quant_utils import is_dequant, is_quant
14-
from executorch.backends.xnnpack.utils.utils import check_or_raise
14+
from executorch.backends.xnnpack.utils.utils import check_or_raise, is_param_node
1515
from executorch.exir.dialects._ops import ops as exir_ops
16+
from torch.export import ExportedProgram
1617

1718

1819
class QuantParams:
@@ -183,6 +184,11 @@ def from_inputs(cls, tensor_node: torch.fx.Node) -> Optional[QuantParams]:
183184
if is_dequant(tensor_node) and TagImplicitQDqPass.is_tagged_as_implicit_q_dq(
184185
tensor_node
185186
):
187+
dq_input = cast(torch.fx.Node, tensor_node.args[0])
188+
if is_quant(dq_input):
189+
q_input = cast(torch.fx.Node, dq_input.args[0])
190+
if q_input.op == "placeholder":
191+
return cls.from_q_dq_node(dq_input)
186192
return cls.from_q_dq_node(tensor_node)
187193

188194
return None

0 commit comments

Comments
 (0)