xref: /aosp_15_r20/external/armnn/src/armnnTestUtils/TensorCopyUtils.cpp (revision 89c4ff92f2867872bb9e2354d150bf0c8c502810)
1 //
2 // Copyright © 2017,2022 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include <armnn/backends/ITensorHandle.hpp>
7 #include <armnnTestUtils/TensorCopyUtils.hpp>
8 #include <Half.hpp>
9 
CopyDataToITensorHandle(armnn::ITensorHandle * tensorHandle,const void * memory)10 void CopyDataToITensorHandle(armnn::ITensorHandle* tensorHandle, const void* memory)
11 {
12     tensorHandle->CopyInFrom(memory);
13 }
14 
CopyDataFromITensorHandle(void * memory,const armnn::ITensorHandle * tensorHandle)15 void CopyDataFromITensorHandle(void* memory, const armnn::ITensorHandle* tensorHandle)
16 {
17     tensorHandle->CopyOutTo(memory);
18 }
19 
AllocateAndCopyDataToITensorHandle(armnn::ITensorHandle * tensorHandle,const void * memory)20 void AllocateAndCopyDataToITensorHandle(armnn::ITensorHandle* tensorHandle, const void* memory)
21 {
22     tensorHandle->Allocate();
23     CopyDataToITensorHandle(tensorHandle, memory);
24 }
25