ashutosh-arm commented on a change in pull request #9409:
URL: https://github.com/apache/tvm/pull/9409#discussion_r752143067
##########
File path: src/relay/backend/contrib/cmsisnn/generate_constants.cc
##########
@@ -105,11 +105,25 @@ class GenerateConstantsMutator : public MixedModeMutator {
conv2d_call = requantize_input;
}
- // Transpose weights: HWIO -> OHWI
auto* conv2d_attrs = conv2d_call->attrs.as<Conv2DAttrs>();
- tvm::Attrs new_conv2d_attrs;
- Expr transposed_kernel =
- ConvertKernelLayout(conv2d_call->args[1], conv2d_attrs,
&new_conv2d_attrs);
+ tvm::Attrs new_conv2d_attrs = conv2d_call->attrs;
+ Expr conv2d_kernel = conv2d_call->args[1];
+
+ bool is_depthwise = false;
+ Array<PrimExpr> input_shape =
conv2d_call->args[0]->type_as<TensorTypeNode>()->shape;
+ Array<PrimExpr> kernel_shape =
conv2d_call->args[1]->type_as<TensorTypeNode>()->shape;
+ std::string kernel_layout = conv2d_attrs->kernel_layout.c_str();
+ int kernel_pos_o = kernel_layout.find("O");
+ int groups = conv2d_attrs->groups;
+ if (groups == qnn::get_const_int(input_shape[3]) &&
+ groups == qnn::get_const_int(kernel_shape[kernel_pos_o])) {
+ is_depthwise = true;
+ }
Review comment:
ACK.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]