mlonmcu.models package
Submodules
mlonmcu.models.convert_data module
Utility to convert various types of data into MLonMCU compatible raw binary files.
mlonmcu.models.frontend module
- class mlonmcu.models.frontend.CoremarkFrontend(features=None, config=None)[source]
Bases:
SimpleFrontend
- REQUIRED = {}
- property supported_names
- class mlonmcu.models.frontend.DhrystoneFrontend(features=None, config=None)[source]
Bases:
SimpleFrontend
- REQUIRED = {}
- property supported_names
- class mlonmcu.models.frontend.EmbenchFrontend(features=None, config=None)[source]
Bases:
SimpleFrontend
- REQUIRED = {'embench.src_dir'}
- property supported_names
- class mlonmcu.models.frontend.ExampleFrontend(features=None, config=None)[source]
Bases:
SimpleFrontend
- property supported_names
- class mlonmcu.models.frontend.Frontend(name, input_formats=None, output_formats=None, features=None, config=None)[source]
Bases:
ABC
- DEFAULTS = {'use_inout_data': False}
- FEATURES = {'validate'}
- OPTIONAL = {}
- REQUIRED = {}
- supports_formats(ins=None, outs=None)[source]
Returs true if the frontend can handle at least one combination of input and output formats.
- property use_inout_data
- class mlonmcu.models.frontend.LayerGenFrontend(features=None, config=None)[source]
Bases:
Frontend
- DEFAULTS = {'fmt': 'tflite', 'use_inout_data': False}
- FEATURES = {'validate'}
- REQUIRED = {'layergen.exe'}
- property fmt
- property layergen_exe
- class mlonmcu.models.frontend.MathisFrontend(features=None, config=None)[source]
Bases:
SimpleFrontend
- REQUIRED = {}
- property supported_names
- class mlonmcu.models.frontend.MibenchFrontend(features=None, config=None)[source]
Bases:
SimpleFrontend
- REQUIRED = {'mibench.src_dir'}
- property supported_names
- class mlonmcu.models.frontend.ONNXFrontend(features=None, config=None)[source]
Bases:
SimpleFrontend
- class mlonmcu.models.frontend.PBFrontend(features=None, config=None)[source]
Bases:
SimpleFrontend
- class mlonmcu.models.frontend.PackedFrontend(features=None, config=None)[source]
Bases:
Frontend
- DEFAULTS = {'check': False, 'fake_pack': False, 'ignore_existing': True, 'use_inout_data': False, 'use_packed': True}
- FEATURES = {'packed', 'packing', 'validate'}
- REQUIRED = {'packer.exe'}
- property check
- property fake_pack
- property ignore_existing
- property use_packed
- class mlonmcu.models.frontend.PaddleFrontend(features=None, config=None)[source]
Bases:
SimpleFrontend
- class mlonmcu.models.frontend.PolybenchFrontend(features=None, config=None)[source]
Bases:
SimpleFrontend
- REQUIRED = {'polybench.src_dir'}
- property supported_names
- class mlonmcu.models.frontend.RelayFrontend(features=None, config=None)[source]
Bases:
SimpleFrontend
- DEFAULTS = {'relayviz_plotter': 'term', 'use_inout_data': False, 'visualize_graph': False}
- FEATURES = {'relayviz', 'validate'}
- REQUIRED = {'tvm.build_dir', 'tvm.pythonpath'}
- property relayviz_plotter
- property tvm_build_dir
- property tvm_pythonpath
- property visualize_graph
- class mlonmcu.models.frontend.SimpleFrontend(name, fmt, features=None, config=None)[source]
Bases:
Frontend
An abstract frontend with equivalent input and output formats.
- class mlonmcu.models.frontend.TaclebenchFrontend(features=None, config=None)[source]
Bases:
SimpleFrontend
- REQUIRED = {'taclebench.src_dir'}
- property supported_names
- class mlonmcu.models.frontend.TfLiteFrontend(features=None, config=None)[source]
Bases:
SimpleFrontend
- DEFAULTS = {'analyze_enable': False, 'analyze_script': None, 'pack_script': None, 'split_layers': False, 'use_inout_data': False, 'visualize_enable': False, 'visualize_script': None}
- FEATURES = {'split_layers', 'tflite_analyze', 'validate', 'visualize'}
- OPTIONAL = {'tflite_analyze.script'}
- REQUIRED = {}
- property analyze_enable
- property analyze_script
- property pack_script
- property split_layers
- property visualize_enable
- property visualize_script
mlonmcu.models.group module
mlonmcu.models.lookup module
mlonmcu.models.metadata module
mlonmcu.models.model module
- class mlonmcu.models.model.MathisProgram(name, config=None, alt=None)[source]
Bases:
Program
- DEFAULTS = {'size': 1024}
- property size
- class mlonmcu.models.model.Model(name, paths, config=None, alt=None, formats=ModelFormats.TFLITE)[source]
Bases:
Workload
- DEFAULTS = {'input_shapes': None, 'input_types': None, 'inputs_path': 'input', 'metadata_path': 'definition.yml', 'output_shapes': None, 'output_types': None, 'outputs_path': 'output', 'support_path': 'support'}
- property input_shapes
- property input_types
- property inputs_path
- property metadata_path
- property output_shapes
- property output_types
- property outputs_path
- property skip_check
- property support_path
- class mlonmcu.models.model.ModelFormat(value, extensions)
Bases:
tuple
- extensions
Alias for field number 1
- value
Alias for field number 0
- class mlonmcu.models.model.ModelFormats(value)[source]
Bases:
Enum
An enumeration.
- IPYNB = (3, ['ipynb'])
- NONE = (0, [])
- ONNX = (4, ['onnx'])
- PACKED = (2, ['tflm'])
- PADDLE = (7, ['pdmodel'])
- PB = (6, ['pb'])
- RELAY = (5, ['relay'])
- TEXT = (8, ['txt'])
- TFLITE = (1, ['tflite'])
- property extension
- property extensions
- class mlonmcu.models.model.Workload(name, config=None, alt=None)[source]
Bases:
object
- DEFAULTS = {}
- mlonmcu.models.model.parse_shape_string(inputs_string)[source]
Parse an input shape dictionary string to a usable dictionary.
Taken from: https://github.com/apache/tvm/blob/main/python/tvm/driver/tvmc/shape_parser.py
- Parameters:
- inputs_string: str
A string of the form “input_name:[dim1,dim2,…,dimn] input_name2:[dim1,dim2]” that indicates the desired shape for specific model inputs. Colons, forward slashes and dots within input_names are supported. Spaces are supported inside of dimension arrays.
- Returns
- ——-
- shape_dict: dict
A dictionary mapping input names to their shape for use in relay frontend converters.
- mlonmcu.models.model.parse_type_string(inputs_string)[source]
Parse an input type dictionary string to a usable dictionary.
- Parameters:
- inputs_string: str
A string of the form “input_name:ty input_name2:ty” that indicates the desired type for specific model inputs/outputs. Colons, forward slashes and dots within input_names are supported. Spaces are supported inside of dimension arrays.
- Returns
- ——-
- type_dict: dict
A dictionary mapping input names to their type.
mlonmcu.models.options module
- class mlonmcu.models.options.BackendModelOptions(backend, supported=True, options={})[source]
Bases:
object
- class mlonmcu.models.options.TFLMIModelOptions(backend, supported=True, arena_size=None, builtin_ops=None, custom_ops=None)[source]
Bases:
BackendModelOptions
- class mlonmcu.models.options.TVMRTModelOptions(backend, supported=True, arena_size=None)[source]
Bases:
BackendModelOptions
mlonmcu.models.utils module
Module contents
- class mlonmcu.models.LayerGenFrontend(features=None, config=None)[source]
Bases:
Frontend
- DEFAULTS = {'fmt': 'tflite', 'use_inout_data': False}
- FEATURES = {'validate'}
- REQUIRED = {'layergen.exe'}
- property fmt
- property layergen_exe
- class mlonmcu.models.ONNXFrontend(features=None, config=None)[source]
Bases:
SimpleFrontend
- class mlonmcu.models.PBFrontend(features=None, config=None)[source]
Bases:
SimpleFrontend
- class mlonmcu.models.PackedFrontend(features=None, config=None)[source]
Bases:
Frontend
- DEFAULTS = {'check': False, 'fake_pack': False, 'ignore_existing': True, 'use_inout_data': False, 'use_packed': True}
- FEATURES = {'packed', 'packing', 'validate'}
- REQUIRED = {'packer.exe'}
- property check
- property fake_pack
- property ignore_existing
- property use_packed
- class mlonmcu.models.TfLiteFrontend(features=None, config=None)[source]
Bases:
SimpleFrontend
- DEFAULTS = {'analyze_enable': False, 'analyze_script': None, 'pack_script': None, 'split_layers': False, 'use_inout_data': False, 'visualize_enable': False, 'visualize_script': None}
- FEATURES = {'split_layers', 'tflite_analyze', 'validate', 'visualize'}
- OPTIONAL = {'tflite_analyze.script'}
- REQUIRED = {}
- property analyze_enable
- property analyze_script
- property pack_script
- property split_layers
- property visualize_enable
- property visualize_script