This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import shutil | |
import tempfile | |
import onnx | |
import onnxruntime as rt | |
from onnxruntime.quantization import QuantType, quantize_dynamic | |
def opt_by_rt(input_model: str, output_model: str): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def to_float_from_11073_16bit_sfloat(data): | |
tmp = int.from_bytes(data, "little") | |
uint16val = np.array([tmp], dtype=np.uint16) | |
tmp = bin(uint16val[0] & 0xfff) | |
mantissa = int(tmp, 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import warnings | |
warnings.filterwarnings('ignore') | |
import pymc3 as pm | |
from pymc3.distributions.dist_math import bound | |
import theano.tensor as tt | |
import theano | |
import numpy as np | |
np.random.seed(seed=32) |