afe.tvm_converter

Submodules

Functions

serialize_irmod(β†’Β None)

TODO(Joey.Chou): Use global config to assign backend_checkers and partitioner

Package Contents

afe.tvm_converter.serialize_irmod(mod: afe._tvm._defines.TVMIRModule, model_name: str, show_partition: bool = True, output_directory: str = '', is_quantized: bool = False) None

TODO(Joey.Chou): Use global config to assign backend_checkers and partitioner TODO(Joey.Chou): Rewrite the serialization using a TVM visitor TODO: Instead of serialize_irmod partitioning the irmodule, it should take in custom names for each expression in

the network. We can then move the partitioning logic outside of the function.

Serializes an IRModule to a JSON file compatible with Netron. Please pass the IRModule through the GraphTransformer() (in afe._tvm._transformer) before passing it into serialize_irmod

If show_partition is True, serialize_irmod() will apply backend checkers and partitioner to partition the IR Module. The expressions in the partitioned IR Module will be visualized with a name as below:

β€œ{BACKEND_NAME} / {EXPRESSION_NAME}_{INDEX}”

  • Default backend checkers = [MLAChecker, EVChecker, APUChecker, CPUChecker]

  • Default partitioner = GreedyPartitioner([Backend.MLA, Backend.EV, Backend.APU, Backend.CPU])

Parameters:
  • mod – TVMIRModule

  • model_name – str. Name of the model. Will be used to name the JSON file.

  • show_partition – bool. Default is False.

  • output_directory – str. Name of the output folder. Default = β€œβ€

  • is_quantized – bool. Whether the model is quantized. Default is False.