diff options
Diffstat (limited to 'driver_library/python/src/ethosu_driver/_utilities')
-rw-r--r-- | driver_library/python/src/ethosu_driver/_utilities/driver_utilities.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/driver_library/python/src/ethosu_driver/_utilities/driver_utilities.py b/driver_library/python/src/ethosu_driver/_utilities/driver_utilities.py index 216895a..fcea91f 100644 --- a/driver_library/python/src/ethosu_driver/_utilities/driver_utilities.py +++ b/driver_library/python/src/ethosu_driver/_utilities/driver_utilities.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright 2021-2022 Arm Limited and/or its affiliates <open-source-office@arm.com> +# SPDX-FileCopyrightText: Copyright 2021-2023 Arm Limited and/or its affiliates <open-source-office@arm.com> # SPDX-License-Identifier: Apache-2.0 import logging import time @@ -49,12 +49,11 @@ def populate_buffers(input_data: List[bytearray], buffers: List[Buffer]): raise RuntimeError("Incorrect number of inputs, expected {}, got {}.".format(number_of_buffers, len(input_data))) for index, (buffer, data_chunk) in enumerate(zip(buffers, input_data)): - cap = buffer.capacity() - logging.info("Copying data to a buffer {} of {} with size = {}".format(index + 1, number_of_buffers, cap)) + size = buffer.size() + logging.info("Copying data to a buffer {} of {} with size = {}".format(index + 1, number_of_buffers, size)) - if len(data_chunk) > cap: - raise RuntimeError("Buffer expects {} bytes, got {} bytes.".format(cap, len(data_chunk))) - buffer.resize(len(data_chunk)) + if len(data_chunk) > size: + raise RuntimeError("Buffer expects {} bytes, got {} bytes.".format(size, len(data_chunk))) buffer.from_buffer(data_chunk) |