Model

Module: polygraphy.tools.args

class ModelArgs(model_opt_required: bool = None, required_model_type: str = None, input_shapes_opt_name: str = None, input_shapes_opt_doc: str = None, guess_model_type_from_runners: bool = None)[source]

Bases: polygraphy.tools.args.base.BaseArgs

Model: the model

Depends on:

  • RunnerSelectArgs: if guess_model_type_from_runners == True

Parameters
  • model_opt_required (bool) – Whether the model argument is required. Defaults to False.

  • required_model_type (str) – The required type of model. Use a value of None for tools that work with multiple model types. If provided, it causes the tool to support only one type of model and disables the --model-type option. Defaults to None.

  • input_shapes_opt_name (str) – The name of the option used to specify input shapes. A second option name will be automatically added by dropping the final s in the specified option and suffixing -shapes. For example, a value of “inputs” would generate an alias called “–input-shapes”. Defaults to “inputs”. Use a value of False to disable the option.

  • input_shapes_opt_doc (str) – Custom help text output for the input shapes option.

  • guess_model_type_from_runners (bool) – Whether to guess the model type based on which runners have been specified, if any. Defaults to False.

class ModelType[source]

Bases: str

parse_impl(args)[source]

Parses command-line arguments and populates the following attributes:

input_shapes

Input names and their shapes.

Type

TensorMetadata

path

Path to the model.

Type

str

model_type

The type of model.

Type

ModelArgs.ModelType