d-smirnov commented on a change in pull request #6532:
URL: https://github.com/apache/incubator-tvm/pull/6532#discussion_r495926886



##########
File path: src/runtime/contrib/arm_compute_lib/acl_runtime.cc
##########
@@ -401,6 +406,50 @@ class ACLRuntime : public JSONRuntimeBase {
     layer->function = function;
   }
 
+  /*!
+   * \brief Creates an add layer
+   *
+   * \param layer The ACL layer to build. Containing inputs, outputs and the 
ACL function.
+   * \param node  The JSON representation of the operator.
+   */
+  void CreateAddLayer(CachedLayer* layer, const JSONGraphNode& node) {
+    layer->inputs.push_back(MakeACLTensorFromJSONEntry(node.GetInputs()[0]));
+    layer->inputs.push_back(MakeACLTensorFromJSONEntry(node.GetInputs()[1]));
+    layer->outputs.push_back(MakeACLTensorFromJSONNode(node));
+    AppendAddOp(layer);
+  }
+
+  /*!
+   * \brief Creates a qnn.add layer
+   *
+   * \param layer The ACL layer to build. Containing inputs, outputs and the 
ACL function.
+   * \param node  The JSON representation of the operator.
+   */
+  void CreateQnnAddLayer(CachedLayer* layer, const JSONGraphNode& node) {
+    layer->inputs.push_back(MakeACLTensorFromJSONEntry(node.GetInputs()[0], 
&node.GetInputs()[2],
+                                                       &node.GetInputs()[3]));
+    layer->inputs.push_back(MakeACLTensorFromJSONEntry(node.GetInputs()[1], 
&node.GetInputs()[4],
+                                                       &node.GetInputs()[5]));
+    layer->outputs.push_back(
+        MakeACLTensorFromJSONNode(node, &node.GetInputs()[6], 
&node.GetInputs()[7]));
+    AppendAddOp(layer);
+  }
+
+  void AppendAddOp(CachedLayer* layer) {
+    /** Initialise the kernel's inputs, output and conversion policy.
+     *
+     * @param[in]  input1 First tensor input. Data types supported: 
U8/QASYMM8/S16/F16/F32
+     * @param[in]  input2 Second tensor input. Data types supported: 
U8/QASYMM8/S16/F16/F32
+     * @param[out] output Output tensor. Data types supported: 
U8/QASYMM8/S16/F16/F32
+     * @param[in]  policy Policy to use to handle overflow.
+     * void configure(ITensor *input1, ITensor *input2, ITensor *output, 
ConvertPolicy policy);
+     */
+    auto f = std::make_shared<arm_compute::NEArithmeticAddition>();
+    f->configure(&layer->inputs[0], &layer->inputs[1], &layer->outputs[0],
+                 arm_compute::ConvertPolicy::WRAP);
+    layer->function = f;
+  }

Review comment:
       updated




----------------------------------------------------------------
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]


Reply via email to