InputInfo

class nvtripy.InputInfo(shape: Sequence[NamedDimension | int | DimensionSize | Tuple[int | DimensionSize, int | DimensionSize, int | DimensionSize]], dtype: dtype)[source]

Bases: object

Captures information about an input to a compiled function.

Parameters:
Example
1inp = tp.InputInfo((2, 4), dtype=tp.float32)
Local Variables
>>> inp
InputInfo<ShapeBounds(min=(2, 4), opt=(2, 4), max=(2, 4)), dimension names: {}, dtype: float32>
Example: Dynamic Dimensions
1# The first dimension will support values in the range [1, 3],
2# optimizing for a size of 2.
3inp = tp.InputInfo(((1, 2, 3), 4), dtype=tp.float32)
Local Variables
>>> inp
InputInfo<ShapeBounds(min=(1, 4), opt=(2, 4), max=(3, 4)), dimension names: {}, dtype: float32>
Example: Naming Dynamic Dimensions
1# Dimensions with the same name must be equal at runtime.
2# This knowledge can help the compiler optimize better.
3window_size = tp.NamedDimension("window_size", 3, 5, 7)
4
5inp = tp.InputInfo((1, window_size, window_size), dtype=tp.float32)
Local Variables
>>> window_size
NamedDimension<name: 'window_size', bounds: (3, 5, 7)>

>>> inp
InputInfo<ShapeBounds(min=(1, 3, 3), opt=(1, 5, 5), max=(1, 7, 7)), dimension names: {1: 'window_size', 2: 'window_size'}, dtype: float32>
dimension_names: Dict[int, str]

A mapping of dimension indices to their names, if set.

shape_bounds: ShapeBounds

The shape bounds of the input.

dtype: dtype

The data type of the input.