MCPcopy Create free account
hub / github.com/ARM-software/armnn / PermuteTensor

Function PermuteTensor

src/backends/backendsCommon/WorkloadUtils.cpp:19–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17{
18
19armnn::ConstTensor PermuteTensor(const ConstTensorHandle* tensor,
20 const PermutationVector& permutationVector, void* permuteBuffer)
21{
22 if (tensor == nullptr)
23 {
24 throw armnn::InvalidArgumentException("WorkloadUtils: PermuteTensor: Null input tensor pointer");
25 }
26 if (permuteBuffer == nullptr)
27 {
28 throw armnn::InvalidArgumentException("WorkloadUtils: PermuteTensor: Null permute buffer pointer");
29 }
30
31 TensorInfo tensorInfo = tensor->GetTensorInfo();
32
33 if (permutationVector.GetSize() > 0)
34 {
35 tensorInfo = armnnUtils::Permuted(tensorInfo, permutationVector);
36 armnnUtils::Permute(tensorInfo.GetShape(), permutationVector,
37 tensor->GetConstTensor<void>(), permuteBuffer,
38 GetDataTypeSize(tensorInfo.GetDataType()));
39 }
40 else
41 {
42 ::memcpy(permuteBuffer, tensor->GetConstTensor<void>(), tensorInfo.GetNumBytes());
43 }
44 tensorInfo.SetConstant(true);
45 return ConstTensor(tensorInfo, permuteBuffer);
46}
47
48void ReshapeWeightsForAcl(TensorInfo& weightInfo, DataLayout dataLayout)
49{

Callers 3

Convert1HWOTensorToAclFunction · 0.85
Convert1HWOtoMIHWFunction · 0.85

Calls 11

PermutedFunction · 0.85
PermuteFunction · 0.85
GetDataTypeSizeFunction · 0.85
GetConstTensor<void>Method · 0.80
SetConstantMethod · 0.80
ConstTensorClass · 0.50
GetSizeMethod · 0.45
GetShapeMethod · 0.45
GetDataTypeMethod · 0.45
GetNumBytesMethod · 0.45

Tested by

no test coverage detected