1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
//
// Copyright © 2021-2023 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
#include "ITensorHandle.hpp"
#include "Workload.hpp"
#include <armnn/Optional.hpp>
#include <armnn/INetwork.hpp>
#include <armnn/TensorFwd.hpp>
#include <memory>
namespace armnn
{
class Layer;
// Workload factory interface for compute backends.
class IWorkloadFactory
{
public:
virtual ~IWorkloadFactory() { }
virtual void AfterWorkloadsCreated() {};
virtual const BackendId& GetBackendId() const = 0;
static bool IsLayerSupported(const BackendId& backendId,
const IConnectableLayer& layer,
Optional<DataType> dataType,
std::string& outReasonIfUnsupported);
static bool IsLayerSupported(const IConnectableLayer& layer,
Optional<DataType> dataType,
std::string& outReasonIfUnsupported);
static bool IsLayerSupported(const IConnectableLayer& layer,
Optional<DataType> dataType,
std::string& outReasonIfUnsupported,
const ModelOptions& modelOptions);
static bool IsLayerSupported(const BackendId& backendId,
const IConnectableLayer& layer,
Optional<DataType> dataType,
std::string& outReasonIfUnsupported,
const ModelOptions& modelOptions);
virtual bool SupportsSubTensors() const = 0;
ARMNN_DEPRECATED_MSG("Use ITensorHandleFactory::CreateSubTensorHandle instead")
virtual std::unique_ptr<ITensorHandle> CreateSubTensorHandle(ITensorHandle& parent,
TensorShape const& subTensorShape,
unsigned int const* subTensorOrigin
) const = 0;
ARMNN_DEPRECATED_MSG("Use ITensorHandleFactory::CreateTensorHandle instead")
virtual std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
const bool IsMemoryManaged = true) const = 0;
ARMNN_DEPRECATED_MSG("Use ITensorHandleFactory::CreateTensorHandle instead")
virtual std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo,
DataLayout dataLayout,
const bool IsMemoryManaged = true) const = 0;
virtual std::unique_ptr<IWorkload> CreateWorkload(LayerType type,
const QueueDescriptor& descriptor,
const WorkloadInfo& info) const;
private:
static bool IsLayerConfigurationSupported(const BackendId& backendId,
const IConnectableLayer& connectableLayer,
Optional<DataType> dataType,
std::string& outReasonIfUnsupported,
const ModelOptions& modelOptions = {});
};
} // namespace armnn
|