5.1. Passes

A pass is a component used to optimise an ONNX model in PopRT. To create a custom pass, see the Custom passes section.

5.1.1. Pass abstract

Passes in PopRT are all inherited from poprt.Pass.

Passes are auto-registered. All registered passes can be listed with the following CLI command:

poprt --list_all_passes

or in Python with:

import poprt

passes = poprt.get_registered_passes()
print(passes.keys())

Use the Python poprt.Pass.get_pass() function to get a pass by its registered name (see Built-in passes for the registered names of built-in passes). You can also use poprt.PassManager to apply multiple passes.

Note

Since the structure of the poprt.passes module may change, the following instructions are not recommended:

from poprt.passes.float_to_half import Float2Half

Float2Half()(onnx_model)