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#
MODELPath to the input
.onnxmodel file.
Options#
--dim NAME=VALUEOverride 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--dimdefault to1.--seed SEEDInteger seed for the random input generator (default:
0).--verbose [LEVEL]/-v [LEVEL]Print run progress. When passed without a level (
--verbose), level1is used.Level
1prints loading progress, input shapes and output shapes.Level
2also prints per-node execution details.
--dump PATHWrite all inputs and outputs to PATH as an ONNX model whose
graph.initializercontains oneTensorProtoper 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#
ReferenceEvaluator— the Python evaluator used under the hood.make_random_input()— the public helper used to synthesize each input tensor.How-to Python / C++ — other onnx-light how-to recipes.