command lines#

compare#

The function convers an onnx file into some code.

python -m compare -m1 model1.onnx -m2 model2.onnx -v 1

Output example:

[compare_onnx_execution] got 2 inputs
[compare_onnx_execution] execute first model
[compare_onnx_execution] got 5 results
[compare_onnx_execution] execute second model
[compare_onnx_execution] got 5 results
[compare_onnx_execution] compute edit distance
[compare_onnx_execution] got 4 pairs
[compare_onnx_execution] done
= | INPUT  float32  5x6             AAAA          X    | INPUT  float32  5x6             AAAA          X
= | INPUT  float32  5x6             AAAA          Y    | INPUT  float32  5x6             AAAA          Y
= | RESULT float32  5x6             AABB Add      res  | RESULT float32  5x6             AABB Add      res
= | RESULT float32  5x6             AAAA Cos      Z    | RESULT float32  5x6             AAAA Cos      Z
    usage: compare [-h] -m1 MODEL1 -m2 MODEL2 [-m {execute,nodes}] [-v VERBOSE] [-c COLUMN_SIZE] [-d DISCREPANCIES]
    
    Compares the execution of two onnx models.
    
    options:
      -h, --help            show this help message and exit
      -m1 MODEL1, --model1 MODEL1
                            first onnx model
      -m2 MODEL2, --model2 MODEL2
                            second onnx model
      -m {execute,nodes}, --mode {execute,nodes}
                            compare the execution ('execute') or the nodes only ('nodes')
      -v VERBOSE, --verbose VERBOSE
                            verbosity
      -c COLUMN_SIZE, --column-size COLUMN_SIZE
                            column size when displaying the results
      -d DISCREPANCIES, --discrepancies DISCREPANCIES
                            show precise discrepancies when mode is execution
    
    This is used when two models are different but should produce the same results.

See function onnx_array_api.reference.compare_onnx_execution().

translate#

The function convers an onnx file into some code.

python -m translate ...

Output example:

not yet ready
    usage: translate [-h] -m MODEL [-a {onnx,light}]
    
    Translates an onnx model into a piece of code to replicate it. The result is printed on the standard output.
    
    options:
      -h, --help            show this help message and exit
      -m MODEL, --model MODEL
                            onnx model to translate
      -a {onnx,light}, --api {onnx,light}
                            API to choose, API from onnx package or light API.
    
    This is mostly used to write unit tests without adding an onnx file to the repository.