-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathModelToINetworkConverter.hpp
60 lines (44 loc) · 1.49 KB
/
ModelToINetworkConverter.hpp
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
//
// Copyright © 2017 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
#include "ArmnnDriver.hpp"
#include "ConversionUtils.hpp"
#include <armnn/ArmNN.hpp>
#include <set>
#include <vector>
namespace armnn_driver
{
enum class ConversionResult
{
Success,
ErrorMappingPools,
UnsupportedFeature
};
// A helper template class performing the conversion from an AndroidNN driver Model representation,
// to an armnn::INetwork object
template<typename HalPolicy>
class ModelToINetworkConverter
{
public:
using HalModel = typename HalPolicy::Model;
ModelToINetworkConverter(const std::vector<armnn::BackendId>& backends,
const HalModel& model,
const std::set<unsigned int>& forcedUnsupportedOperations);
ConversionResult GetConversionResult() const { return m_ConversionResult; }
// Returns the ArmNN INetwork corresponding to the input model, if preparation went smoothly, nullptr otherwise.
armnn::INetwork* GetINetwork() const { return m_Data.m_Network.get(); }
bool IsOperationSupported(uint32_t operationIndex) const;
private:
void Convert();
// Shared aggregate input/output/internal data
ConversionData m_Data;
// Input data
const HalModel& m_Model;
const std::set<unsigned int>& m_ForcedUnsupportedOperations;
// Output data
ConversionResult m_ConversionResult;
std::map<uint32_t, bool> m_OperationSupported;
};
} // armnn_driver