blob: 7685061eb3ca50bc1d096e2d8c43a33efa222cd7 [file] [log] [blame]
Derek Lamberti84da38b2019-06-13 11:40:08 +01001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6#pragma once
7
8#include <armnn/Types.hpp>
9#include <armnn/IRuntime.hpp>
10
11namespace armnn
12{
13
14class ITensorHandleFactory
15{
16public:
17 using FactoryId = std::string;
18 static const FactoryId LegacyFactoryId; // Use the workload factory to create the tensor handle
19 static const FactoryId DeferredFactoryId; // Some TensorHandleFactory decisions are deferred to run-time
20
21 virtual ~ITensorHandleFactory() {}
22
23
24 virtual std::unique_ptr<ITensorHandle> CreateSubTensorHandle(ITensorHandle& parent,
25 TensorShape const& subTensorShape,
26 unsigned int const* subTensorOrigin) const = 0;
27
28 virtual std::unique_ptr<ITensorHandle> CreateTensorHandle(const TensorInfo& tensorInfo) const = 0;
29
30 virtual const FactoryId GetId() const = 0;
31
32 virtual bool SupportsSubTensors() const = 0;
33
34 virtual bool SupportsMapUnmap() const final { return true; }
35
36 virtual bool SupportsExport() const final { return false; }
37
38 virtual bool SupportsImport() const final { return false; }
39};
40
41enum class MemoryStrategy
42{
43 Undefined,
44 DirectCompatibility, // Only allocate the tensorhandle using the assigned factory
45 CopyToTarget, // Default + Insert MemCopy node before target
46 ExportToTarget, // Default + Insert Import node
47};
48
49} //namespace armnn