VitisInspector
is an experimental new feature
introduced in Vitis AI 2.5 to inspect a float model and show partition results for a
given DPU target architecture, together with some indications on why the layers are not
mapped to DPU. Without target
, we can only show some
general, target-independent inspection results. Assign target
to get more detailed inspect results for it. Note: This feature in only available for default
pof2s
quantize strategy due to DPU limitations.
This feature is experimental, please contact us if you encounter any bugs or
problems.The following codes show how to inspect a
model.
model = tf.keras.models.load_model(‘float_model.h5’)
from tensorflow_model_optimization.quantization.keras import vitis_inspect
inspector = vitis_inspect.VitisInspector(target="DPUCADF8H_ISA0")
inspector.inspect_model(model,
plot=True,
plot_file="model.svg",
dump_results=True,
dump_results_file="inspect_results.txt",
verbose=0)
- target
- string or None, the target DPU to deploy this model. It can be a name string (for example, DPUCAHX8L_ISA0), a JSON file path (for example, ./U50/arch.json) or a fingerprint. If set to None, no target will be applied and only some general, target-independent inspect results will be shown. The default value is None.
- model
- tf.keras.Model instance, the float model to be inspected.
Float model should have concrete input shapes. Build the float model with
concrete input shapes or call inspect_model with the
input_shape
argument. - input_shape
- list(int) or list(list(int)), contains the input shape for each input layer. Use default shape info in the input layers if not set. Use list of shapes for multiple inputs, for example inspect_model(model, input_shape=[224, 224, 3]) or inspect_model(model, input_shape=[[224, 224, 3], [64, 1]]). All dimensions should have concrete values, and batch_size dimension should be omitted. The default value is None.
- plot
- bool, whether to plot the model inspect results by
graphviz
and save image to disk. It is helpful when you need to visualize the model inspection results together with some modification hints. Note that only part of output file types can show the hints, such as.svg
.The default value is False. - plot_file
- string, file path of model image file when plotting the model. The default value is model.svg.
- dump_results
- bool, whether to dump the inspect results and save text to disk. More detailed layer-by-layer results than screen logging will be dumped to the text file. The default value is False.
- dump_results_file
- string, file path of inspect results text file. The default value is inspect_results.txt.
- verbose
- int, the logging verbosity level. More detailed logging results will be shown for higher verbose value. The default value is 0.