diff options
author | Matthew Sloyan <matthew.sloyan@arm.com> | 2022-10-28 18:02:17 +0100 |
---|---|---|
committer | Matthew Sloyan <matthew.sloyan@arm.com> | 2022-11-02 15:08:37 +0000 |
commit | 164bf4f29f6f1b2a3e6714ef4f5a21fc0fd16c2b (patch) | |
tree | e7296130a787578e1be4d3a93de46a9c466944b4 /src/backends/tosaReference/TosaRefLayerSupport.cpp | |
parent | 2e950f4fa774ac995230addea898f3b11bf146cc (diff) | |
download | armnn-164bf4f29f6f1b2a3e6714ef4f5a21fc0fd16c2b.tar.gz |
IVGCVSW-7164 Implement TosaRefBackend::OptimizeSubgraphView
* Added TosaRefBackend::OptimizeSubgraphView implementation.
* Generalised TosaRefLayerSupport::IsLayerSupported to work with any
operator.
* Changed TosaCommon.hpp utils to inline functions.
* Added source files for TosaMappings.hpp and AdditionOperator.hpp.
* Fixed multiple defines issue with HALF_ROUND_STYLE and
HALF_ROUND_TIES_TO_EVEN.
Signed-off-by: Matthew Sloyan <matthew.sloyan@arm.com>
Change-Id: Ib2576ec3fb97faa3a2256b2fb93ec16ac8745760
Diffstat (limited to 'src/backends/tosaReference/TosaRefLayerSupport.cpp')
-rw-r--r-- | src/backends/tosaReference/TosaRefLayerSupport.cpp | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/src/backends/tosaReference/TosaRefLayerSupport.cpp b/src/backends/tosaReference/TosaRefLayerSupport.cpp index 18530bb535..f5f34a814b 100644 --- a/src/backends/tosaReference/TosaRefLayerSupport.cpp +++ b/src/backends/tosaReference/TosaRefLayerSupport.cpp @@ -95,25 +95,36 @@ bool TosaRefLayerSupport::IsLayerSupported(const LayerType& type, IgnoreUnused(lstmParamsInfo); IgnoreUnused(quantizedLstmInputParamsInfo); - // Setup Inputs - const auto input0 = infos[0]; - const TensorInfo* ptr0 = &input0; - const auto input1 = infos[1]; - const TensorInfo* ptr1 = &input1; - std::vector<const TensorInfo*> inputInfos = {ptr0, ptr1}; - - // Setup Outputs - const auto output = infos[2]; - const TensorInfo* ptr2 = &output; - std::vector<const TensorInfo*> outputInfos = {ptr2}; + std::vector<const TensorInfo*> inputInfos; + std::vector<const TensorInfo*> outputInfos; + + switch (type) + { + case LayerType::Addition: + // Setup inputs and outputs + inputInfos.push_back(&infos[0]); + inputInfos.push_back(&infos[1]); + outputInfos.push_back(&infos[2]); + break; + case LayerType::Input: + case LayerType::Output: + return true; + default: + break; + } auto mappings = GetTosaMapping(type, inputInfos, outputInfos, descriptor); + if (mappings->GetName() == "") + { + // There currently isn't a TOSA mapping for this layer, as the default was returned. + return false; + } // Loop through block and get each tensor and operator for (long unsigned int i = 0; i < mappings->GetOperators().size(); ++i) { // While looping over operators check for op_UNKNOWN which is unsupported - if (mappings->GetOperators()[i]->GetOp() == tosa::Op_UNKNOWN) { return false;} + if (mappings->GetOperators()[i]->GetOp() == tosa::Op_UNKNOWN) { return false; } // Loop over operators and get GetInput/OutputTensorNames, loop over resulting names and // use GetTensorByName to pass pointers to tensors on to the IsTosaLayerSupported() |