Source code for afe

#########################################################
# Copyright (C) 2022 SiMa Technologies, Inc.
#
# This material is SiMa proprietary and confidential.
#
# This material may not be copied or distributed without
# the express prior written permission of SiMa.
#
# All rights reserved.
#########################################################
# Code owner: Christopher Rodrigues
#########################################################
"""
The API for AFE as a library.

Functions in this file are re-exported from other modules.
See those modules for documentation.
"""

import sys
[docs] python_version = sys.version_info
if (python_version.major, python_version.minor) < (3, 10): sys.exit('Sorry, Python < 3.10 is not supported in Model SDK') import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # Import torch here to ensure PyTorch is imported before TVM # Otherwise we see "invalid pointer - core dump" import torch from afe.ir.serializer.api import load_awesomenet, save_awesomenet from afe.apis.prerelease_v1 import ( load_tensorflow_model, load_pytorch_model, load_tflite_model, load_onnx_model, load_keras_model, load_caffe_model, load_caffe2_model, DataGenerator, quantize_net, execute_net, compile_net, simulate_isim_module )
[docs] CALIBRATED_POSTFIX = "_calibrated"
[docs] QUANTIZED_POSTFIX = "_quantized"
_version_file = os.path.dirname(os.path.abspath(__file__)) + "/VERSION.in" try:
[docs] f = open(_version_file)
except OSError: raise OSError(f"Could not open/read version file: {_version_file}") with f: _version_src = f.readlines() _version = {key.strip(): value.strip() for (key, value) in [s.split(":") for s in _version_src]} __version__ = f"{_version['major']}.{_version['minor']}.{_version['patch']}"