blob: af1be87b5af48916b7dc193427eb7cb5add411c5 [file] [log] [blame]
Kevin Petita7ac3132024-01-08 15:27:25 +00001//
2// This confidential and proprietary software may be used only as
3// authorised by a licensing agreement from ARM Limited
4// (C) COPYRIGHT 2020-2024 ARM Limited
5// ALL RIGHTS RESERVED
6// The entire notice above must be reproduced on all authorised
7// copies and copies may only be made to the extent permitted
8// by a licensing agreement from ARM Limited.
9
10ERROR_IF(tensor_size(shape1) != tensor_size(shape));
11
12for_each(index in shape) {
13 // Calculate flattened index for the output location (index)
14 size_t offset = tensor_index_to_offset(shape, index);
15 // Now convert to the location in the input
Eric Kunze526f6c72024-01-12 17:18:42 -080016 shape_t tmp_index = tensor_offset_to_index(shape1, offset);
Kevin Petita7ac3132024-01-08 15:27:25 +000017
18 // Now read/write the value
19 in_out_t val = tensor_read<in_out_t>(input1, shape1, tmp_index);
20 tensor_write<in_out_t>(output, shape, index, val);
21}