Source code for afe.apis.simulate

#! /usr/bin/env python3

"""
Load a YAML file and use the MLC files referred in the YAML to generate the trace files.
"""
import argparse
import afe
from afe.core.utils import load_configs_from_yaml


def _parse_args():
    parser = argparse.ArgumentParser(description='Given a YAML, create trace file for each of the MLC files')
    parser.add_argument('-yaml', '--yaml', required=True, type=str,
                        help='YAML file that has model configuration, optimization configuration,'
                             ' and JSON and npz file path to load the quantized model')
    args = parser.parse_args()
    return args


def _main(yaml_file):
    # Load model config and optimization config from a YAML file
    model_config, opt_config = load_configs_from_yaml(yaml_file)

    # Simulate and generate trace files
    afe.simulate_network(model_config=model_config,
                         opt_config=opt_config)


[docs] def main(): args = _parse_args() _main(args.yaml)
if __name__ == "__main__": main()