lhutton1 commented on a change in pull request #6109:
URL: https://github.com/apache/incubator-tvm/pull/6109#discussion_r459578673
##########
File path: src/relay/backend/contrib/arm_compute_lib/codegen.cc
##########
@@ -78,57 +90,83 @@ class ACLJSONSerializer : public
backend::contrib::JSONSerializer {
private:
/*!
- * \brief Create a JSON representation of a composite convolution.
+ * \brief Extract convolution nodes from a composite function.
*
- * \param call The call to be represented.
- * \return A JSON representation of a specific operator.
+ * \param cn The call node of the composite function.
+ * \return Extracted composite convolution nodes.
*/
- std::shared_ptr<JSONGraphNode> CreateCompositeConvJSONNode(const CallNode*
cn) {
- const std::string name = "nn.conv2d";
- const CallNode* pad = nullptr;
- const CallNode* conv = nullptr;
- const CallNode* bias = nullptr;
- bool has_activation = false;
-
- // Unpack composite function
+ static CompositeConvNodes UnpackCompositeConvolution(const CallNode* cn) {
+ CompositeConvNodes nodes{};
const auto* fn = cn->op.as<FunctionNode>();
CHECK(fn);
const auto* current_call = fn->body.as<CallNode>();
+ if (backend::IsOp(current_call, "qnn.requantize")) {
+ nodes.requantize = current_call;
+ current_call = current_call->args[0].as<CallNode>();
+ }
if (backend::IsOp(current_call, "nn.relu")) {
- has_activation = true;
+ nodes.activation = current_call;
current_call = current_call->args[0].as<CallNode>();
}
if (backend::IsOp(current_call, "nn.bias_add")) {
- bias = current_call;
+ nodes.bias = current_call;
current_call = current_call->args[0].as<CallNode>();
}
- CHECK(backend::IsOp(current_call, "nn.conv2d"));
- conv = current_call;
+ if (nodes.requantize) {
+ CHECK(backend::IsOp(current_call, "qnn.conv2d"));
Review comment:
Hoping I understood correctly... Not sure that would work because an
assert in the first condition enforces that nn.conv2d must come immediately
before nn.relu with no other calls in-between. For example if we had nn.conv2d
-> nn.bias_add -> nn.relu, using the example above compilation would fail as a
call to nn.conv2d is expected immediately after nn.relu.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]