File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33# This source code is licensed under the BSD-style license found in the
44# LICENSE file in the root directory of this source tree.
55
6- from importlib .util import find_spec
7-
8-
9- def _missing_dependencies_error (missing : str ) -> ModuleNotFoundError :
10- return ModuleNotFoundError (
11- "Cortex-M backend dependencies are not installed "
12- f"(missing: { missing } ). Install ExecuTorch with "
13- "`pip install executorch[cortex_m]`, or if building from source run "
14- "`examples/arm/setup.sh --i-agree-to-the-contained-eula`."
15- )
16-
17-
18- def _ensure_cortex_m_dependencies () -> None :
19- required_modules = {
20- "cmsis_nn" : "cmsis_nn" ,
21- }
22- missing_packages = []
23- for module_name , package_name in required_modules .items ():
24- try :
25- if find_spec (module_name ) is None :
26- missing_packages .append (package_name )
27- except (ImportError , ValueError ):
28- missing_packages .append (package_name )
29-
30- if missing_packages :
31- raise _missing_dependencies_error (", " .join (missing_packages ))
32-
33-
34- _ensure_cortex_m_dependencies ()
35-
366from .cortex_m_pass import CortexMPass # noqa # usort: skip
377from .activation_fusion_pass import ActivationFusionPass # noqa
388from .aten_to_cortex_m_pass import AtenToCortexMPass # noqa
You can’t perform that action at this time.
0 commit comments