From 7db78969dc8ead72f3ded81b6d2a6a7ed798ea62 Mon Sep 17 00:00:00 2001 From: Louis Verhaard Date: Mon, 25 May 2020 15:05:26 +0200 Subject: 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 --- ethosu/vela/architecture_features.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ethosu/vela/architecture_features.py') diff --git a/ethosu/vela/architecture_features.py b/ethosu/vela/architecture_features.py index c712588f..1bf9d950 100644 --- a/ethosu/vela/architecture_features.py +++ b/ethosu/vela/architecture_features.py @@ -21,6 +21,7 @@ from configparser import ConfigParser 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 @@ Note the difference between ArchitectureFeatures and CompilerOptions 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 @@ Note the difference between ArchitectureFeatures and CompilerOptions 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")) -- cgit v1.2.1