blob: 17e14cdd99df2fed98229bc459a2f769eef62d7b (
plain)
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
|
//
// Copyright © 2017 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
#include <backendsCommon/Workload.hpp>
#include <aclCommon/ArmComputeTensorUtils.hpp>
#include <neon/NeonTensorHandle.hpp>
#include <neon/NeonTimer.hpp>
#include <backendsCommon/CpuTensorHandle.hpp>
#include <arm_compute/runtime/NEON/NEFunctions.h>
#include <Half.hpp>
#define ARMNN_SCOPED_PROFILING_EVENT_NEON(name) \
ARMNN_SCOPED_PROFILING_EVENT_WITH_INSTRUMENTS(armnn::Compute::CpuAcc, \
name, \
armnn::NeonTimer(), \
armnn::WallClockTimer())
using namespace armnn::armcomputetensorutils;
namespace armnn
{
template <typename T>
void CopyArmComputeTensorData(arm_compute::Tensor& dstTensor, const T* srcData)
{
InitialiseArmComputeTensorEmpty(dstTensor);
CopyArmComputeITensorData(srcData, dstTensor);
}
inline void InitializeArmComputeTensorData(arm_compute::Tensor& tensor,
const ConstCpuTensorHandle* handle)
{
BOOST_ASSERT(handle);
switch(handle->GetTensorInfo().GetDataType())
{
case DataType::Float16:
CopyArmComputeTensorData(tensor, handle->GetConstTensor<armnn::Half>());
break;
case DataType::Float32:
CopyArmComputeTensorData(tensor, handle->GetConstTensor<float>());
break;
case DataType::QuantisedAsymm8:
CopyArmComputeTensorData(tensor, handle->GetConstTensor<uint8_t>());
break;
case DataType::Signed32:
CopyArmComputeTensorData(tensor, handle->GetConstTensor<int32_t>());
break;
default:
BOOST_ASSERT_MSG(false, "Unexpected tensor type.");
}
};
} //namespace armnn
|