From: Ivan Vagin/AI Tools Lab /SRR/Engineer/삼성전자 Date: Wed, 23 Jan 2019 20:57:29 +0000 (+0300) Subject: [nnc] Allocate ACL elementwise op output and temporary tensors (#2914) X-Git-Tag: nncc_backup~930 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0d2f07f31edc1e96e6c7398653065baceb0d13ec;p=platform%2Fcore%2Fml%2Fnnfw.git [nnc] Allocate ACL elementwise op output and temporary tensors (#2914) Allocate ACL elementwise op output and temporary tensors Signed-off-by: Ivan Vagin --- diff --git a/contrib/nnc/passes/acl_soft_backend/AclCppOpGenerator.cpp b/contrib/nnc/passes/acl_soft_backend/AclCppOpGenerator.cpp index 8f69740..a93af66 100644 --- a/contrib/nnc/passes/acl_soft_backend/AclCppOpGenerator.cpp +++ b/contrib/nnc/passes/acl_soft_backend/AclCppOpGenerator.cpp @@ -637,6 +637,7 @@ void AclCppOpGenerator::visit(ops::TanhOp& op) { void AclCppOpGenerator::visit(ops::ElementwiseOp& op) { // Create the output tensor in the DOM and obtain its identifier. auto out = genTensor(op, op.getOutputShape(0)); + addToPersistentTensors(out); auto& prev_nodes = op.getPrevNodes(); assert(prev_nodes.size() >= 2); @@ -675,11 +676,11 @@ void AclCppOpGenerator::visit(ops::DeConv2DOp& op) { } void AclCppOpGenerator::visit(ops::EluOp&) { - throw AclCppException("Not supported by the ACL library yet."); + throw AclCppException("EluOp not supported by the ACL library yet."); } void AclCppOpGenerator::visit(ops::PadOp&) { - throw AclCppException("Not supported by the ACL library yet."); + throw AclCppException("PadOp not supported by the ACL library yet."); } template @@ -832,12 +833,14 @@ shared_ptr AclCppOpGenerator::genMultiplication(const string& prefix // Create a unit tensor in the DOM. auto unit = genTensor(operation_name + "_unit", ir_unit_shape); + addToPersistentTensors(unit); // Fill the unit tensor with the 1 value. fillTensor(unit, "1"); // Create a tmp tensor in the DOM to store the result of 1 / in2. auto tmp = genTensor(operation_name + "_tmp", ir_shape); + genTensorAllocation(_infBlock, tmp); // Create an instance of the CLArithmeticDivision class as a member of the artifact class. auto arithmetic_div_layer_var1 = _artifactClass->var(false, "arm_compute::CLArithmeticDivision", @@ -863,6 +866,8 @@ shared_ptr AclCppOpGenerator::genMultiplication(const string& prefix // Generate the call: arithmetic_div_layer2.run(); _infBlock->call("run", {}, arithmetic_div_layer2); + genTensorDeallocation(_infBlock, tmp); + return out; }