This is an automated email from the ASF dual-hosted git repository.
masahi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new 506eff23b0 [Relay][Frontend][QNN] fix access `param_debug_name_map` to
node output name in fx-quantized graph node replacement (#16217)
506eff23b0 is described below
commit 506eff23b034cfd88dda44cf5040ab8b40683155
Author: SunWook Jung <[email protected]>
AuthorDate: Wed Dec 27 17:37:29 2023 +0900
[Relay][Frontend][QNN] fix access `param_debug_name_map` to node output
name in fx-quantized graph node replacement (#16217)
* update qnn_torch.py
* remove unused function
---
python/tvm/relay/frontend/qnn_torch.py | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/python/tvm/relay/frontend/qnn_torch.py
b/python/tvm/relay/frontend/qnn_torch.py
index 13e426ccd7..a6d536eacc 100644
--- a/python/tvm/relay/frontend/qnn_torch.py
+++ b/python/tvm/relay/frontend/qnn_torch.py
@@ -25,7 +25,7 @@ from tvm.relay import op as _op
from tvm.relay.frontend.common import infer_shape
from .common import logger
-from .pytorch_utils import is_version_greater_than, getattr_attr_name
+from .pytorch_utils import is_version_greater_than
class QNNParam(object):
@@ -540,18 +540,11 @@ def inline_input_quant_params_for_fx(graph, params,
param_debug_name_map):
# pylint: disable=c-extension-no-member
import torch
- def get_full_attr_name(current):
- current_attr = getattr_attr_name(current)
- inputs = list(current.inputs())
- if len(inputs) == 1 and inputs[0].node().kind() == "prim::GetAttr":
- return get_full_attr_name(inputs[0].node()) + "." + current_attr
- return current_attr
-
for node in graph.findAllNodes("prim::GetAttr", recurse=True):
out_name = node.output().debugName()
if "_scale" in out_name or "_zero_point" in out_name:
- full_attr = param_debug_name_map[get_full_attr_name(node)]
+ full_attr = param_debug_name_map[out_name]
assert full_attr in params, f"{full_attr} not found in param dict."
param_np = params[full_attr].numpy()
new_const_node = graph.create("prim::Constant")