experimental_experiment.onnx_tools¶
- experimental_experiment.onnx_tools.onnx_lighten(onx: str | ModelProto, verbose: int = 0) Tuple[ModelProto, Dict[str, Dict[str, float]]] [source]¶
Creates a model without big initializers but stores statistics into dictionaries. The function can be reversed with
experimental_experiment.onnx_tools.onnx_unlighten()
. The model is modified inplace.- Parameters:
onx – model
verbose – verbosity
- Returns:
new model, statistics
- experimental_experiment.onnx_tools.onnx_unlighten(onx: str | ModelProto, stats: Dict[str, Dict[str, float]] | None = None, verbose: int = 0) ModelProto [source]¶
Function fixing the model produced by function
experimental_experiment.onnx_tools.onnx_lighten()
. The model is modified inplace.- Parameters:
onx – model
stats – statics, can be None if onx is a file, then it loads the file
<filename>.stats
, it assumes it is json formatverbose – verbosity
- Returns:
new model, statistics