run#

Generates random inputs for every graph input using the onnx-light deterministic pseudo-random generators and runs the model through the onnx-light runtime.

python -m onnx_light run model.onnx

Synopsis:

python -m onnx_light run MODEL [--dim NAME=VALUE ...]
                               [--seed SEED]
                               [--verbose [LEVEL]]
                               [--dump PATH]

Positional argument#

MODEL

Path to the input .onnx model file.

Options#

--dim NAME=VALUE

Override a symbolic (dynamic) dimension by name. May be given multiple times (e.g. --dim batch=4 --dim seq=16). Dimensions that have no concrete value and are not covered by --dim default to 1.

--seed SEED

Integer seed for the random input generator (default: 0).

--verbose [LEVEL] / -v [LEVEL]

Print run progress. When passed without a level (--verbose), level 1 is used.

  • Level 1 prints loading progress, input shapes and output shapes.

  • Level 2 also prints per-node execution details.

--dump PATH

Write all inputs and outputs to PATH as an ONNX model whose graph.initializer contains one TensorProto per tensor. Non-array outputs (e.g. sequences) are skipped.

Examples#

Run a model with random inputs:

python -m onnx_light run model.onnx

Set a specific batch size and sequence length for dynamic models:

python -m onnx_light run model.onnx --dim batch=4 --dim seq=128

Use a fixed random seed for reproducible results:

python -m onnx_light run model.onnx --seed 42

Print input/output shapes and execution progress:

python -m onnx_light run model.onnx --verbose
python -m onnx_light run model.onnx --verbose 2

Save the inputs and outputs to a file for later inspection:

python -m onnx_light run model.onnx --dump io_tensors.onnx

See also#