MLBEDSW-2067: added custom exceptions
Added custom exceptions to handle different types of input errors.
Also performed minor formatting changes using flake8/black.
Change-Id: Ie5b05361507d5e569aff045757aec0a4a755ae98
Signed-off-by: Louis Verhaard <louis.verhaard@arm.com>
diff --git a/ethosu/vela/architecture_features.py b/ethosu/vela/architecture_features.py
index c712588..1bf9d95 100644
--- a/ethosu/vela/architecture_features.py
+++ b/ethosu/vela/architecture_features.py
@@ -21,6 +21,7 @@
import numpy as np
+from .errors import OptionError
from .numeric_util import round_up
from .numeric_util import round_up_divide
from .operation import NpuBlockType
@@ -158,7 +159,7 @@
self.vela_config = vela_config
self.accelerator_config = accelerator_config
if self.accelerator_config not in ArchitectureFeatures.accelerator_configs:
- raise Exception("Unknown accelerator configuration " + self.accelerator_config)
+ raise OptionError("--accelerator-config", self.accelerator_config, "Unknown accelerator configuration")
accel_config = ArchitectureFeatures.accelerator_configs[self.accelerator_config]
self.config = accel_config
@@ -564,7 +565,7 @@
else:
section_key = "SysConfig." + self.system_config
if section_key not in self.vela_config:
- raise Exception("Unknown system configuration " + self.system_config)
+ raise OptionError("--system-config", self.system_config, "Unknown system configuration")
try:
self.npu_clock = float(self.__sys_config("npu_freq", "500e6"))