diff options
author | Diego Russo <diego.russo@arm.com> | 2022-05-30 13:34:14 +0100 |
---|---|---|
committer | Diego Russo <diego.russo@arm.com> | 2022-05-30 13:34:14 +0100 |
commit | 0efca3cadbad5517a59884576ddb90cfe7ac30f8 (patch) | |
tree | abed6cb6fbf3c439fc8d947f505b6a53d5daeb1e /tests/mlia/test_devices_ethosu_performance.py | |
parent | 0777092695c143c3a54680b5748287d40c914c35 (diff) | |
download | mlia-0efca3cadbad5517a59884576ddb90cfe7ac30f8.tar.gz |
Add MLIA codebase0.3.0-rc.1
Add MLIA codebase including sources and tests.
Change-Id: Id41707559bd721edd114793618d12ccd188d8dbd
Diffstat (limited to 'tests/mlia/test_devices_ethosu_performance.py')
-rw-r--r-- | tests/mlia/test_devices_ethosu_performance.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/mlia/test_devices_ethosu_performance.py b/tests/mlia/test_devices_ethosu_performance.py new file mode 100644 index 0000000..e27efa0 --- /dev/null +++ b/tests/mlia/test_devices_ethosu_performance.py @@ -0,0 +1,28 @@ +# SPDX-FileCopyrightText: Copyright 2022, Arm Limited and/or its affiliates. +# SPDX-License-Identifier: Apache-2.0 +"""Performance estimation tests.""" +from unittest.mock import MagicMock + +import pytest + +from mlia.devices.ethosu.performance import MemorySizeType +from mlia.devices.ethosu.performance import MemoryUsage + + +def test_memory_usage_conversion() -> None: + """Test MemoryUsage objects conversion.""" + memory_usage_in_kb = MemoryUsage(1, 2, 3, 4, 5, MemorySizeType.KILOBYTES) + assert memory_usage_in_kb.in_kilobytes() == memory_usage_in_kb + + memory_usage_in_bytes = MemoryUsage( + 1 * 1024, 2 * 1024, 3 * 1024, 4 * 1024, 5 * 1024 + ) + assert memory_usage_in_bytes.in_kilobytes() == memory_usage_in_kb + + +def mock_performance_estimation(monkeypatch: pytest.MonkeyPatch) -> None: + """Mock performance estimation.""" + monkeypatch.setattr( + "mlia.tools.aiet_wrapper.estimate_performance", + MagicMock(return_value=MagicMock()), + ) |