Data Loader

Module: polygraphy.tools.args

class DataLoaderArgs(allow_custom_input_shapes: bool | None = None)[source]

Bases: BaseArgs

Data Loader: loading or generating input data for inference.

Depends on:

  • ModelArgs: if allow_custom_input_shapes == True

Parameters:

allow_custom_input_shapes (bool) – Whether to allow custom input shapes when randomly generating data. Defaults to True.

parse_impl(args)[source]
seed

The seed to use for random data generation.

Type:

int

val_range

Per-input ranges of values to generate.

Type:

Dict[str, Tuple[int]]

iterations

The number of iterations for which to generate data.

Type:

int

load_inputs_paths

Path(s) from which to load inputs.

Type:

List[str]

data_loader_script

Path to a custom script to load inputs.

Type:

str

data_loader_func_name

Name of the function in the custom data loader script that loads data.

Type:

str

data_loader_backend_module

Module to be used that provides arrays.

Type:

str

add_to_script_impl(script, user_input_metadata_str=None)[source]
Parameters:

user_input_metadata_str (str(TensorMetadata)) – The name of a variable containing TensorMetadata. This will control the shape and data type of the generated data.

Returns:

The data loader, as a string. This may either be the variable name,

or an invocation of the data loader function.

Return type:

str

get_data_loader(user_input_metadata=None)[source]

Creates a data loader according to arguments provided on the command-line.

Returns:

Sequence[OrderedDict[str, numpy.ndarray]]

is_using_random_data()[source]

Whether this data loader will randomly generate data rather than use real data.

Returns:

bool