blob: e805f2600d910335ffe92b77ec933f6fef4213c6 [file] [log] [blame]
telsoa015307bc12018-03-09 13:51:08 +00001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
3// See LICENSE file in the project root for full license information.
4//
5
6#pragma once
7
telsoa01ce3e84a2018-08-31 09:31:35 +01008#include "ArmnnDriver.hpp"
9
10#include <NeuralNetworks.h>
11
telsoa015307bc12018-03-09 13:51:08 +000012#include <armnn/ArmNN.hpp>
13#include <CpuExecutor.h>
14
15#include <vector>
16#include <string>
17
18namespace armnn_driver
19{
20
21extern const armnn::PermutationVector g_DontPermute;
22
23class UnsupportedOperand: public std::runtime_error
24{
25public:
26 UnsupportedOperand(const OperandType type)
27 : std::runtime_error("Operand type is unsupported")
28 , m_type(type)
29 {}
30
31 OperandType m_type;
32};
33
34/// Swizzles tensor data in @a input according to the dimension mappings.
35void SwizzleAndroidNn4dTensorToArmNn(const armnn::TensorInfo& tensor, const void* input, void* output,
36 const armnn::PermutationVector& mappings);
37
38/// Returns a pointer to a specific location in a pool
39void* GetMemoryFromPool(DataLocation location,
40 const std::vector<android::nn::RunTimePoolInfo>& memPools);
41
42/// Can throw UnsupportedOperand
43armnn::TensorInfo GetTensorInfoForOperand(const Operand& operand);
44
45std::string GetOperandSummary(const Operand& operand);
telsoa01ce3e84a2018-08-31 09:31:35 +010046std::string GetModelSummary(const ::android::hardware::neuralnetworks::V1_0::Model& model);
telsoa015307bc12018-03-09 13:51:08 +000047
48void DumpTensor(const std::string& dumpDir,
telsoa01ce3e84a2018-08-31 09:31:35 +010049 const std::string& requestName,
50 const std::string& tensorName,
51 const armnn::ConstTensor& tensor);
52
53void DumpJsonProfilingIfRequired(bool gpuProfilingEnabled,
54 const std::string& dumpDir,
55 armnn::NetworkId networkId,
56 const armnn::IProfiler* profiler);
telsoa015307bc12018-03-09 13:51:08 +000057
surmeh0176660052018-03-29 16:33:54 +010058void ExportNetworkGraphToDotFile(const armnn::IOptimizedNetwork& optimizedNetwork,
59 const std::string& dumpDir,
telsoa01ce3e84a2018-08-31 09:31:35 +010060 const ::android::hardware::neuralnetworks::V1_0::Model& model);
61
telsoa015307bc12018-03-09 13:51:08 +000062}