Skip to content

Commit 640979d

Browse files
authored
Arm backend: Allow for TOSA tests to run without ethos-u-vela (#8732)
Support running TOSA only tests without ethos-u-vela pip package installed. Raise a RuntimeError to direct user to the right missing package if trying to use the backend without the package importable. Signed-off-by: Per Åstrand <[email protected]>
1 parent 2909e34 commit 640979d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

backends/arm/arm_vela.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@
1212
from typing import List
1313

1414
import numpy as np
15-
from ethosu.vela import vela # type: ignore
15+
16+
try:
17+
from ethosu.vela import vela # type: ignore
18+
19+
has_vela = True
20+
except ImportError:
21+
has_vela = False
1622

1723

1824
# Pack either input or output tensor block, compose the related arrays into
@@ -45,6 +51,11 @@ def vela_compile(
4551
"""
4652
Compile a TOSA graph to a binary stream for ArmBackendEthosU using Vela.
4753
"""
54+
if not has_vela:
55+
raise RuntimeError(
56+
"ethos-u-vela pip package couldn't be imported. Make sure it's installed!"
57+
)
58+
4859
with tempfile.TemporaryDirectory() as tmpdir:
4960
tosaname = "out.tosa"
5061
tosa_path = os.path.join(tmpdir, tosaname)

0 commit comments

Comments
 (0)