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