telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1 | // |
Colm Donelan | a98e79a | 2022-12-06 21:32:29 +0000 | [diff] [blame] | 2 | // Copyright © 2017,2022 Arm Ltd and Contributors. All rights reserved. |
David Beck | ecb56cd | 2018-09-05 12:52:57 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 4 | // |
5 | |||||
Colm Donelan | a98e79a | 2022-12-06 21:32:29 +0000 | [diff] [blame] | 6 | #include <armnn/backends/ITensorHandle.hpp> |
Sadik Armagan | a097d2a | 2021-11-24 15:47:28 +0000 | [diff] [blame] | 7 | #include <armnnTestUtils/TensorCopyUtils.hpp> |
Aron Virginas-Tar | c9cc804 | 2018-11-01 16:15:57 +0000 | [diff] [blame] | 8 | #include <Half.hpp> |
arovir01 | 616e775 | 2018-10-01 17:08:59 +0100 | [diff] [blame] | 9 | |
David Beck | 09e2f27 | 2018-10-30 11:38:41 +0000 | [diff] [blame] | 10 | void CopyDataToITensorHandle(armnn::ITensorHandle* tensorHandle, const void* memory) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 11 | { |
David Beck | 09e2f27 | 2018-10-30 11:38:41 +0000 | [diff] [blame] | 12 | tensorHandle->CopyInFrom(memory); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 13 | } |
14 | |||||
David Beck | 09e2f27 | 2018-10-30 11:38:41 +0000 | [diff] [blame] | 15 | void CopyDataFromITensorHandle(void* memory, const armnn::ITensorHandle* tensorHandle) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 16 | { |
David Beck | 09e2f27 | 2018-10-30 11:38:41 +0000 | [diff] [blame] | 17 | tensorHandle->CopyOutTo(memory); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 18 | } |
19 | |||||
David Beck | 09e2f27 | 2018-10-30 11:38:41 +0000 | [diff] [blame] | 20 | void AllocateAndCopyDataToITensorHandle(armnn::ITensorHandle* tensorHandle, const void* memory) |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 21 | { |
22 | tensorHandle->Allocate(); | ||||
David Beck | 09e2f27 | 2018-10-30 11:38:41 +0000 | [diff] [blame] | 23 | CopyDataToITensorHandle(tensorHandle, memory); |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 24 | } |