telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 1 | // |
| 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 | |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame^] | 8 | #include "ArmnnDriver.hpp" |
| 9 | |
| 10 | #include <NeuralNetworks.h> |
| 11 | |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 12 | #include <armnn/ArmNN.hpp> |
| 13 | #include <CpuExecutor.h> |
| 14 | |
| 15 | #include <vector> |
| 16 | #include <string> |
| 17 | |
| 18 | namespace armnn_driver |
| 19 | { |
| 20 | |
| 21 | extern const armnn::PermutationVector g_DontPermute; |
| 22 | |
| 23 | class UnsupportedOperand: public std::runtime_error |
| 24 | { |
| 25 | public: |
| 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. |
| 35 | void 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 |
| 39 | void* GetMemoryFromPool(DataLocation location, |
| 40 | const std::vector<android::nn::RunTimePoolInfo>& memPools); |
| 41 | |
| 42 | /// Can throw UnsupportedOperand |
| 43 | armnn::TensorInfo GetTensorInfoForOperand(const Operand& operand); |
| 44 | |
| 45 | std::string GetOperandSummary(const Operand& operand); |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame^] | 46 | std::string GetModelSummary(const ::android::hardware::neuralnetworks::V1_0::Model& model); |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 47 | |
| 48 | void DumpTensor(const std::string& dumpDir, |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame^] | 49 | const std::string& requestName, |
| 50 | const std::string& tensorName, |
| 51 | const armnn::ConstTensor& tensor); |
| 52 | |
| 53 | void DumpJsonProfilingIfRequired(bool gpuProfilingEnabled, |
| 54 | const std::string& dumpDir, |
| 55 | armnn::NetworkId networkId, |
| 56 | const armnn::IProfiler* profiler); |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 57 | |
surmeh01 | 7666005 | 2018-03-29 16:33:54 +0100 | [diff] [blame] | 58 | void ExportNetworkGraphToDotFile(const armnn::IOptimizedNetwork& optimizedNetwork, |
| 59 | const std::string& dumpDir, |
telsoa01 | ce3e84a | 2018-08-31 09:31:35 +0100 | [diff] [blame^] | 60 | const ::android::hardware::neuralnetworks::V1_0::Model& model); |
| 61 | |
telsoa01 | 5307bc1 | 2018-03-09 13:51:08 +0000 | [diff] [blame] | 62 | } |