Matteo Martincigh | 88054f8 | 2019-05-17 12:15:30 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #pragma once |
| 7 | |
Matteo Martincigh | e5b8eb9 | 2019-11-28 15:45:42 +0000 | [diff] [blame] | 8 | #include <armnn/backends/IBackendInternal.hpp> |
| 9 | #include <armnn/backends/OptimizationViews.hpp> |
David Monahan | 7f2c35a | 2019-05-24 10:46:28 +0100 | [diff] [blame] | 10 | #include <LayerSupportCommon.hpp> |
| 11 | #include <backendsCommon/LayerSupportBase.hpp> |
Matteo Martincigh | 88054f8 | 2019-05-17 12:15:30 +0100 | [diff] [blame] | 12 | |
| 13 | namespace armnn |
| 14 | { |
| 15 | |
| 16 | class MockBackend : public IBackendInternal |
| 17 | { |
| 18 | public: |
| 19 | MockBackend() = default; |
| 20 | ~MockBackend() = default; |
| 21 | |
| 22 | static const BackendId& GetIdStatic(); |
| 23 | const BackendId& GetId() const override { return GetIdStatic(); } |
| 24 | |
| 25 | IBackendInternal::IMemoryManagerUniquePtr CreateMemoryManager() const override; |
| 26 | |
| 27 | IBackendInternal::IWorkloadFactoryPtr CreateWorkloadFactory( |
| 28 | const IBackendInternal::IMemoryManagerSharedPtr& memoryManager = nullptr) const override; |
| 29 | |
| 30 | IBackendInternal::IBackendContextPtr CreateBackendContext(const IRuntime::CreationOptions&) const override; |
Colm Donelan | e49755b | 2020-01-29 15:22:43 +0000 | [diff] [blame] | 31 | IBackendInternal::IBackendProfilingContextPtr CreateBackendProfilingContext( |
| 32 | const IRuntime::CreationOptions& creationOptions, |
| 33 | armnn::profiling::IBackendProfiling& backendProfiling) const override; |
Matteo Martincigh | 88054f8 | 2019-05-17 12:15:30 +0100 | [diff] [blame] | 34 | |
| 35 | IBackendInternal::Optimizations GetOptimizations() const override; |
| 36 | IBackendInternal::ILayerSupportSharedPtr GetLayerSupport() const override; |
| 37 | |
| 38 | OptimizationViews OptimizeSubgraphView(const SubgraphView& subgraph) const override; |
| 39 | }; |
| 40 | |
David Monahan | 7f2c35a | 2019-05-24 10:46:28 +0100 | [diff] [blame] | 41 | class MockLayerSupport : public LayerSupportBase { |
| 42 | public: |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 43 | bool IsInputSupported(const TensorInfo& /*input*/, |
| 44 | Optional<std::string&> /*reasonIfUnsupported = EmptyOptional()*/) const override |
David Monahan | 7f2c35a | 2019-05-24 10:46:28 +0100 | [diff] [blame] | 45 | { |
| 46 | return true; |
| 47 | } |
| 48 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 49 | bool IsOutputSupported(const TensorInfo& /*input*/, |
| 50 | Optional<std::string&> /*reasonIfUnsupported = EmptyOptional()*/) const override |
David Monahan | 7f2c35a | 2019-05-24 10:46:28 +0100 | [diff] [blame] | 51 | { |
| 52 | return true; |
| 53 | } |
| 54 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 55 | bool IsAdditionSupported(const TensorInfo& /*input0*/, |
| 56 | const TensorInfo& /*input1*/, |
| 57 | const TensorInfo& /*output*/, |
| 58 | Optional<std::string&> /*reasonIfUnsupported = EmptyOptional()*/) const override |
David Monahan | 7f2c35a | 2019-05-24 10:46:28 +0100 | [diff] [blame] | 59 | { |
| 60 | return true; |
| 61 | } |
| 62 | |
Derek Lamberti | 901ea11 | 2019-12-10 22:07:09 +0000 | [diff] [blame] | 63 | bool IsConvolution2dSupported(const TensorInfo& /*input*/, |
| 64 | const TensorInfo& /*output*/, |
| 65 | const Convolution2dDescriptor& /*descriptor*/, |
| 66 | const TensorInfo& /*weights*/, |
| 67 | const Optional<TensorInfo>& /*biases*/, |
| 68 | Optional<std::string&> /*reasonIfUnsupported = EmptyOptional()*/) const override |
David Monahan | 7f2c35a | 2019-05-24 10:46:28 +0100 | [diff] [blame] | 69 | { |
| 70 | return true; |
| 71 | } |
| 72 | }; |
| 73 | |
Matteo Martincigh | 88054f8 | 2019-05-17 12:15:30 +0100 | [diff] [blame] | 74 | } // namespace armnn |