-m onnx_diagnostic optimize … optimizes an onnx model

Description

See onnx_diagnostic.helpers.optim_helper.optimize_model().

    usage: optimize [-h] [-o OUTPUT] [-v VERBOSE] [--infer-shapes | --no-infer-shapes] [--processor PROCESSOR] [--remove-shape-info | --no-remove-shape-info]
                    {ir,os_ort,slim,default,default+onnxruntime} input
    
    Optimizes an onnx model by fusing nodes. It looks for patterns in the graphs
    and replaces them by the corresponding nodes. It also does basic optimization
    such as removing identity nodes or unused nodes.
    
    positional arguments:
      {ir,os_ort,slim,default,default+onnxruntime}
                            algorithm or patterns optimization to apply
      input                 onnx model to optimize
    
    options:
      -h, --help            show this help message and exit
      -o OUTPUT, --output OUTPUT
                            onnx model to output, if empty, if adds .opt-{algorithm}.onnx to the name
      -v VERBOSE, --verbose VERBOSE
                            verbosity
      --infer-shapes, --no-infer-shapes
                            infer shapes before optimizing the model
      --processor PROCESSOR
                            optimization for a specific processor, CPU, CUDA or both CPU,CUDA,
                            some operators are only available in one processor, it might be not used
                            with all
      --remove-shape-info, --no-remove-shape-info
                            remove shape information before outputting the model
    
    The goal is to make the model faster.
    Argument patterns defines the patterns to apply or the set of patterns.
    It is possible to show statistics or to remove a particular pattern.
    Here are some environment variables which can be used to trigger
    these displays.
    
    Available options algorithms, default and default+runtime:
    
    - DROPPATTERN=<pattern1,patterns2,...>: do not apply
      those patterns when optimizing a model
    - DUMPPATTERNS=<folder>: dumps all matched and applied
      nodes when a pattern is applied
    - PATTERN=<pattern1,pattern2,...>: increase verbosity for specific
        patterns to understand why one pattern was not applied,
        this shows which line is rejecting a pattern if it seems one pattern was missed