Matteo Martincigh | d0dc770 | 2019-08-01 17:09:03 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "IBackendInternal.hpp" |
| 7 | |
| 8 | namespace armnn |
| 9 | { |
| 10 | |
| 11 | ARMNN_NO_DEPRECATE_WARN_BEGIN |
| 12 | IBackendInternal::ISubGraphConverterPtr IBackendInternal::CreateSubGraphConverter( |
| 13 | const std::shared_ptr<SubGraph>& subGraph) const |
| 14 | { |
| 15 | return ISubGraphConverterPtr{}; |
| 16 | } |
| 17 | |
| 18 | IBackendInternal::Optimizations IBackendInternal::GetOptimizations() const |
| 19 | { |
| 20 | return Optimizations{}; |
| 21 | } |
| 22 | |
| 23 | IBackendInternal::SubGraphUniquePtr IBackendInternal::OptimizeSubGraph(const SubGraph& subGraph, |
| 24 | bool& optimizationAttempted) const |
| 25 | { |
| 26 | optimizationAttempted = false; |
| 27 | return nullptr; |
| 28 | } |
| 29 | ARMNN_NO_DEPRECATE_WARN_END |
| 30 | |
| 31 | IMemoryManagerUniquePtr IBackendInternal::CreateMemoryManager() const |
| 32 | { |
| 33 | return IMemoryManagerUniquePtr(); |
| 34 | } |
| 35 | |
Narumol Prangnawarat | 11bd261 | 2019-08-13 10:26:53 +0100 | [diff] [blame] | 36 | IBackendInternal::IWorkloadFactoryPtr IBackendInternal::CreateWorkloadFactory( |
| 37 | class TensorHandleFactoryRegistry& tensorHandleFactoryRegistry) const |
| 38 | { |
| 39 | return IWorkloadFactoryPtr{}; |
| 40 | } |
| 41 | |
Matteo Martincigh | d0dc770 | 2019-08-01 17:09:03 +0100 | [diff] [blame] | 42 | IBackendInternal::IBackendContextPtr IBackendInternal::CreateBackendContext(const IRuntime::CreationOptions&) const |
| 43 | { |
| 44 | return IBackendContextPtr{}; |
| 45 | } |
| 46 | |
| 47 | // Default implementation of OptimizeSubgraphView for backward compatibility with the old API. |
| 48 | // Override this method with a custom optimization implementation. |
| 49 | OptimizationViews IBackendInternal::OptimizeSubgraphView(const SubgraphView& subgraph) const |
| 50 | { |
| 51 | bool optimizationAttempted = false; |
| 52 | |
| 53 | ARMNN_NO_DEPRECATE_WARN_BEGIN |
| 54 | SubGraphUniquePtr optSubgraph = OptimizeSubGraph(subgraph, optimizationAttempted); |
| 55 | ARMNN_NO_DEPRECATE_WARN_END |
| 56 | |
| 57 | OptimizationViews result; |
| 58 | if (!optimizationAttempted) |
| 59 | { |
| 60 | result.AddUntouchedSubgraph(SubgraphView(subgraph)); |
| 61 | } |
| 62 | else if (optSubgraph) |
| 63 | { |
| 64 | result.AddSubstitution({subgraph, SubgraphView(*optSubgraph.get())}); |
| 65 | } |
| 66 | else |
| 67 | { |
| 68 | result.AddFailedSubgraph(SubgraphView(subgraph)); |
| 69 | } |
| 70 | |
| 71 | return result; |
| 72 | } |
| 73 | |
| 74 | bool IBackendInternal::SupportsTensorAllocatorAPI() const |
| 75 | { |
| 76 | return !GetHandleFactoryPreferences().empty(); |
| 77 | } |
| 78 | |
| 79 | ITensorHandleFactory::FactoryId IBackendInternal::GetBackwardCompatibleFavoriteHandleFactory() |
| 80 | { |
| 81 | auto favorites = GetHandleFactoryPreferences(); |
| 82 | if (favorites.empty()) |
| 83 | { |
| 84 | return ITensorHandleFactory::LegacyFactoryId; |
| 85 | } |
| 86 | |
| 87 | return favorites[0]; |
| 88 | } |
| 89 | |
| 90 | std::vector<ITensorHandleFactory::FactoryId> IBackendInternal::GetHandleFactoryPreferences() const |
| 91 | { |
| 92 | return std::vector<ITensorHandleFactory::FactoryId>(); |
| 93 | } |
| 94 | |
| 95 | } // namespace armnn |