diff options
Diffstat (limited to 'pseudocode/operators/VARIABLE_READ.tosac')
-rw-r--r-- | pseudocode/operators/VARIABLE_READ.tosac | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/pseudocode/operators/VARIABLE_READ.tosac b/pseudocode/operators/VARIABLE_READ.tosac new file mode 100644 index 0000000..c2e0e38 --- /dev/null +++ b/pseudocode/operators/VARIABLE_READ.tosac @@ -0,0 +1,26 @@ +// +// This confidential and proprietary software may be used only as +// authorised by a licensing agreement from ARM Limited +// (C) COPYRIGHT 2020-2024 ARM Limited +// ALL RIGHTS RESERVED +// The entire notice above must be reproduced on all authorised +// copies and copies may only be made to the extent permitted +// by a licensing agreement from ARM Limited. + + +tensor_t variable_tensor = variable_tensor_lookup(uid); +// Check this variable tensor has been decalred +REQUIRE(variable_tensor != NULL); +// Check this variable tensor has been written +REQUIRE(variable_tensor.is_written); +// Output tensor's shape and variable_tensor's shape have to match +REQUIRE(variable_tensor.shape == shape); +// Output tensor's shape and variable_tensor's type have to match +REQUIRE(variable_tensor.type == out_t); + +for_each (index in shape) { + // Read data from pseudo-buffer resource to the output + out_t value = tensor_read<tensor_t>(variable_tensor.data, variable_tensor.shape, index); + tensor_write<out_t>(input1, shape, index, value); +} + |