Narumol Prangnawarat | b8d771a | 2020-08-14 11:51:12 +0100 | [diff] [blame] | 1 | // |
Mike Kelly | 3ec3077 | 2023-03-08 13:47:17 +0000 | [diff] [blame] | 2 | // Copyright © 2020-2021,2023 Arm Ltd and Contributors. All rights reserved. |
Narumol Prangnawarat | b8d771a | 2020-08-14 11:51:12 +0100 | [diff] [blame] | 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: |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 17 | bool IsLayerSupported(const LayerType& type, |
| 18 | const std::vector<TensorInfo>& infos, |
Mike Kelly | 3ec3077 | 2023-03-08 13:47:17 +0000 | [diff] [blame] | 19 | const BaseDescriptor& descriptor, |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 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); |
Mike Kelly | 3ec3077 | 2023-03-08 13:47:17 +0000 | [diff] [blame] | 28 | case LayerType::ElementwiseBinary: |
| 29 | { |
| 30 | auto elementwiseDesc = *(PolymorphicDowncast<const ElementwiseBinaryDescriptor*>(&descriptor)); |
| 31 | return (elementwiseDesc.m_Operation == BinaryOperation::Add); |
| 32 | } |
Cathal Corbett | 34b429c | 2021-12-24 12:24:40 +0000 | [diff] [blame] | 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 | |
Narumol Prangnawarat | b8d771a | 2020-08-14 11:51:12 +0100 | [diff] [blame] | 46 | 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 | |
| 58 | bool IsInputSupported(const TensorInfo& input, |
| 59 | Optional<std::string&> reasonIfUnsupported) const override |
| 60 | { |
| 61 | IgnoreUnused(input); |
| 62 | IgnoreUnused(reasonIfUnsupported); |
| 63 | return true; |
| 64 | } |
| 65 | |
| 66 | 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 |