ArmNN
 25.11
Loading...
Searching...
No Matches
TosaRefWorkloadFactory.hpp
Go to the documentation of this file.
1//
2// Copyright © 2022 Arm Ltd and Contributors. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5#pragma once
6
8
9#include <armnn/Optional.hpp>
12
13
14namespace armnn
15{
16
17// Reference workload factory.
19{
20public:
21 explicit TosaRefWorkloadFactory(const std::shared_ptr<TosaRefMemoryManager>& memoryManager);
23
25
26 const BackendId& GetBackendId() const override;
27
28 static bool IsLayerSupported(const Layer& layer,
29 Optional<DataType> dataType,
30 std::string& outReasonIfUnsupported);
31
32 static bool IsLayerSupported(const IConnectableLayer& layer,
33 Optional<DataType> dataType,
34 std::string& outReasonIfUnsupported,
35 const ModelOptions& modelOptions);
36
37 bool SupportsSubTensors() const override { return false; }
38
39 ARMNN_DEPRECATED_MSG("Use ITensorHandleFactory::CreateSubTensorHandle instead")
41 TensorShape const& subTensorShape,
42 unsigned int const* subTensorOrigin) const override
43 {
44 IgnoreUnused(parent, subTensorShape, subTensorOrigin);
45 return nullptr;
46 }
47
48 ARMNN_DEPRECATED_MSG("Use ITensorHandleFactory::CreateTensorHandle instead")
49 std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
50 const bool IsMemoryManaged = true) const override;
51
52 ARMNN_DEPRECATED_MSG("Use ITensorHandleFactory::CreateTensorHandle instead")
53 std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
54 DataLayout dataLayout,
55 const bool IsMemoryManaged = true) const override;
56
57 std::unique_ptr<IWorkload> CreateWorkload(LayerType type,
58 const QueueDescriptor& descriptor,
59 const WorkloadInfo& info) const override;
60
61private:
62 template <typename F32Workload, typename U8Workload, typename QueueDescriptorType>
63 std::unique_ptr<IWorkload> MakeWorkload(const QueueDescriptorType& descriptor, const WorkloadInfo& info) const;
64
65 mutable std::shared_ptr<TosaRefMemoryManager> m_MemoryManager;
66};
67
68} // namespace armnn
#define ARMNN_DEPRECATED_MSG(message)
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
Definition INetwork.hpp:81
Workload interface to enqueue a layer computation.
Definition IWorkload.hpp:14
TosaRefWorkloadFactory(const std::shared_ptr< TosaRefMemoryManager > &memoryManager)
std::unique_ptr< ITensorHandle > CreateTensorHandle(const TensorInfo &tensorInfo, const bool IsMemoryManaged=true) const override
std::unique_ptr< IWorkload > CreateWorkload(LayerType type, const QueueDescriptor &descriptor, const WorkloadInfo &info) const override
Backends should implement their own CreateWorkload function with a switch statement.
static bool IsLayerSupported(const Layer &layer, Optional< DataType > dataType, std::string &outReasonIfUnsupported)
std::unique_ptr< ITensorHandle > CreateSubTensorHandle(ITensorHandle &parent, TensorShape const &subTensorShape, unsigned int const *subTensorOrigin) const override
const BackendId & GetBackendId() const override
Copyright (c) 2021 ARM Limited and Contributors.
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below.
Definition Types.hpp:494
std::vector< BackendOptions > ModelOptions
DataLayout
Definition Types.hpp:63
void IgnoreUnused(Ts &&...)
Contains information about TensorInfos of a layer.