module cli.optimize#

Short summary#

module mlprodict.cli.optimize

Command line about model optimisation.

source on GitHub

Functions#

function

truncated documentation

onnx_optim

Optimizes an ONNX model.

onnx_stats

Computes statistics on an ONNX model.

Documentation#

Command line about model optimisation.

source on GitHub

mlprodict.cli.optimize.onnx_optim(name, outfile=None, recursive=True, options=None, verbose=0, fLOG=None)#

Optimizes an ONNX model.

Parameters:
  • name – filename

  • outfile – output filename

  • recursive – processes the main graph and the subgraphs

  • options – options, kind of optimize to do

  • verbose – display statistics before and after the optimisation

  • fLOG – logging function

Optimizes an ONNX graph

The command optimizes an ONNX model.

<<<

python -m mlprodict onnx_optim --help

>>>

usage: onnx_optim [-h] [-n NAME] [-o OUTFILE] [-r RECURSIVE] [-op OPTIONS]
                  [-v VERBOSE]

Optimizes an ONNX model.

optional arguments:
  -h, --help            show this help message and exit
  -n NAME, --name NAME  filename (default: None)
  -o OUTFILE, --outfile OUTFILE
                        output filename (default: )
  -r RECURSIVE, --recursive RECURSIVE
                        processes the main graph and the subgraphs (default:
                        True)
  -op OPTIONS, --options OPTIONS
                        options, kind of optimize to do (default: )
  -v VERBOSE, --verbose VERBOSE
                        display statistics before and after the optimisation
                        (default: 0)

source on GitHub

mlprodict.cli.optimize.onnx_stats(name, optim=False, kind=None)#

Computes statistics on an ONNX model.

Parameters:
  • name – filename

  • optim – computes statistics before an after optimisation was done

  • kind – kind of statistics, if left unknown, prints out the metadata, possible values: * io: prints input and output name, type, shapes * node: prints the distribution of node types * text: printts a text summary

Computes statistics on an ONNX graph

The command computes statistics on an ONNX model.

<<<

python -m mlprodict onnx_stats --help

>>>

usage: onnx_stats [-h] [-n NAME] [-o OPTIM] [-k KIND]

Computes statistics on an ONNX model.

optional arguments:
  -h, --help            show this help message and exit
  -n NAME, --name NAME  filename (default: None)
  -o OPTIM, --optim OPTIM
                        computes statistics before an after optimisation was
                        done (default: False)
  -k KIND, --kind KIND  kind of statistics, if left unknown, prints out the
                        metadata, possible values: * `io`: prints input and
                        output name, type, shapes * `node`: prints the
                        distribution of node types * `text`: printts a text
                        summary (default: )

source on GitHub