• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright © 2020-2021,2023 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
7 #include <armnn/utility/IgnoreUnused.hpp>
8 
9 #include <backendsCommon/LayerSupportBase.hpp>
10 
11 namespace armnn
12 {
13 
14 class MockImportLayerSupport : public LayerSupportBase
15 {
16 public:
IsLayerSupported(const LayerType & type,const std::vector<TensorInfo> & infos,const BaseDescriptor & descriptor,const Optional<LstmInputParamsInfo> &,const Optional<QuantizedLstmInputParamsInfo> &,Optional<std::string &> reasonIfUnsupported) const17     bool IsLayerSupported(const LayerType& type,
18                           const std::vector<TensorInfo>& infos,
19                           const BaseDescriptor& descriptor,
20                           const Optional<LstmInputParamsInfo>& /*lstmParamsInfo*/,
21                           const Optional<QuantizedLstmInputParamsInfo>& /*quantizedLstmParamsInfo*/,
22                           Optional<std::string&> reasonIfUnsupported) const override
23     {
24         switch(type)
25         {
26             case LayerType::Addition:
27                 return IsAdditionSupported(infos[0], infos[1], infos[2], reasonIfUnsupported);
28             case LayerType::ElementwiseBinary:
29             {
30                 auto elementwiseDesc = *(PolymorphicDowncast<const ElementwiseBinaryDescriptor*>(&descriptor));
31                 return (elementwiseDesc.m_Operation == BinaryOperation::Add);
32             }
33             case LayerType::Input:
34                 return IsInputSupported(infos[0], reasonIfUnsupported);
35             case LayerType::Output:
36                 return IsOutputSupported(infos[0], reasonIfUnsupported);
37             case LayerType::MemCopy:
38                 return LayerSupportBase::IsMemCopySupported(infos[0], infos[1], reasonIfUnsupported);
39             case LayerType::MemImport:
40                 return LayerSupportBase::IsMemImportSupported(infos[0], infos[1], reasonIfUnsupported);
41             default:
42                 return false;
43         }
44     }
45 
IsAdditionSupported(const TensorInfo & input0,const TensorInfo & input1,const TensorInfo & output,Optional<std::string &> reasonIfUnsupported=EmptyOptional ()) const46     bool IsAdditionSupported(const TensorInfo& input0,
47                              const TensorInfo& input1,
48                              const TensorInfo& output,
49                              Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const override
50     {
51         IgnoreUnused(input0);
52         IgnoreUnused(input1);
53         IgnoreUnused(output);
54         IgnoreUnused(reasonIfUnsupported);
55         return true;
56     }
57 
IsInputSupported(const TensorInfo & input,Optional<std::string &> reasonIfUnsupported) const58     bool IsInputSupported(const TensorInfo& input,
59                           Optional<std::string&> reasonIfUnsupported) const override
60     {
61         IgnoreUnused(input);
62         IgnoreUnused(reasonIfUnsupported);
63         return true;
64     }
65 
IsOutputSupported(const TensorInfo & output,Optional<std::string &> reasonIfUnsupported) const66     bool IsOutputSupported(const TensorInfo& output,
67                            Optional<std::string&> reasonIfUnsupported) const override
68     {
69         IgnoreUnused(output);
70         IgnoreUnused(reasonIfUnsupported);
71         return true;
72     }
73 };
74 
75 } // namespace armnn
76