Skip to content


Infery allows users to analyze deep learning model's basic properties. This data is stored as the models' metadata, inputs and outputs. Start by loading your model:

import infery
model = infery.Model('/path/to/model.onnx')

High-Level Metadata

The easiest way to see all input/output metadata of your model is through the metadata property. There are also a couple of batch-size-related properties you may access.

# Get all inputs/outputs metadata

# A model is considered dynamic if it supports inference with varying batch sizes.

# A dynamic model has a "None" batch size. A static model will return an int specifying the static batch size here. 

Inputs, Outputs, and Metadata

You may view shapes, names and dtypes of models' inputs and outputs by utilizing the inputs and outputs properties:

# List of model input names (simply switch "inputs" to "outputs" to access outputs' metadata)

# Dictionary of model's dynamic axes ({input_name : {axis_index: label}})

# List of TensorSpecs - the underlying objects that actually contain the metadata.
For certain frameworks (e.g. PyTorch), a model may be valid without specified input names/dimensions/dtypes. In this case None will we returned for inputs and outputs.

TensorSpecs and Axes

  • Inputs and outputs are composed of TensorSpecs. Specs hold a list of Axis objects.
  • Every Axis may have a value, range, and/or label.
  • If a model is dynamic at a certain axis, this axis will have a range and/or label.
  • If a model is static at a certain axis, this axis will have a value and possibly a label. A label has no real significance other than helping refer to an axis or marking it as fully dynamic in the case where there is not value or range.
  • For example - if a model has a "batch_size" label for Axis 0, no value and no range, it may receive inputs with varying batch sizes. The same axis may be labeled "foo" as still have the same exact functionality.
# Get all axes of a model's first input:

# Get the name of a model's first input (identical to model.inputs.names[0])

# Get the dtype of a model;s first input

To check out the different properties of the first Axis of your model's first TensorSpec: