Skip to content
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

type checking for xnnpack #7741

Merged
merged 1 commit into from
Jan 21, 2025
Merged
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
4 changes: 3 additions & 1 deletion backends/xnnpack/_passes/tag_implicit_q_dq_pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ def is_supported_quant_op(self, node: torch.fx.Node) -> bool:

# Weight and Input should both be quantized
if op_name == exir_ops.edge.aten.convolution.default.name():
return is_dequant(node.args[1])
if isinstance(node.args[1], torch.fx.Node):
# pyre-ignore Incompatible parameter type [6]: is_dequant expects Node
return is_dequant(node.args[1])

return op_name in SUPPORTED_IMPLICIT_Q_DQ_OP_NAMES_SET

Expand Down
4 changes: 2 additions & 2 deletions backends/xnnpack/operators/node_visitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,11 +560,11 @@ def get_serialized_buffer_index(
# which should be used for depthwise/transpose convolution weights for XNNPACK
shape = const_val.shape
const_val = const_val.reshape(
(groups, const_val.shape[0] // groups) + const_val.shape[1:]
(groups, const_val.shape[0] // groups) + tuple(const_val.shape[1:])
)
const_val = const_val.permute((0, 2, 1) + tuple(range(3, const_val.dim())))
const_val = const_val.reshape(
(shape[1] * groups, shape[0] // groups) + shape[2:]
(shape[1] * groups, shape[0] // groups) + tuple(shape[2:])
).contiguous()

if convert_to_nhwc:
Expand Down
Loading