| 17 | { |
| 18 | |
| 19 | armnn::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 | |
| 48 | void ReshapeWeightsForAcl(TensorInfo& weightInfo, DataLayout dataLayout) |
| 49 | { |
no test coverage detected