crazydemo commented on code in PR #10837:
URL: https://github.com/apache/tvm/pull/10837#discussion_r846908670
##########
src/relay/transforms/fold_scale_axis.cc:
##########
@@ -580,14 +581,38 @@ Expr Conv2DForwardRewrite(const Call& ref_call, const
Array<Expr>& new_args,
if (!weight.defined()) return Expr();
}
}
- // return transformed conv2d
+ // return transformed conv
return Call(ref_call->op, {sdata->value, weight}, ref_call->attrs,
ref_call->type_args);
}
-RELAY_REGISTER_OP("nn.conv2d").set_attr<FForwardPrep>("FScaleAxisForwardPrep",
Conv2DForwardPrep);
+Array<Message> PreConvForwardPrep(const Call& call, const Message&
out_message) {
+ if (backend::IsOp(call.as<CallNode>(), "nn.conv2d")) {
+ const auto* param = call->attrs.as<Conv2DAttrs>();
+ return ConvForwardPrep(call, param, out_message);
+ }
+ const auto* param = call->attrs.as<Conv3DAttrs>();
+ return ConvForwardPrep(call, param, out_message);
+}
+
+Expr PreConvForwardRewrite(const Call& ref_call, const Array<Expr>& new_args,
+ const Message& message) {
+ if (backend::IsOp(ref_call.as<CallNode>(), "nn.conv2d")) {
+ const auto* param = ref_call->attrs.as<Conv2DAttrs>();
+ return ConvForwardRewrite(ref_call, param, new_args, message);
+ }
+ const auto* param = ref_call->attrs.as<Conv3DAttrs>();
Review Comment:
Got it.
--
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]