ShapeExpr¶
- class tensorrt.plugin.ShapeExpr(value: int | IDimensionExpr | ShapeExpr | None = None)¶
Symbolic expression for single dimension of a tensor
- Parameters:
value (Union[int, trt.IDimensionExpr, ShapeExpr], optional) – Constant or another symbolic expression. Defaults to creating a fake shape expression.
- constant_value() int ¶
Return value of the constant shape expression.
- Raises:
RuntimeError – For non-constant shape expressions. Check
is_constant
to determine accessibility.
- property is_constant: bool¶
True if this shape expression is a build-time constant, False otherwise.
- property is_fake: bool¶
A ShapeExpr may be “fake” when it is accessed in a non-shape calculation context. Fake ShapeExpr`s are externally indistinguishable unless `is_constant or constant_value is required.
- property is_size_tensor: bool¶
True if this represents a size tensor, False otherwise.
- class tensorrt.plugin.ShapeExprs(length: int, _is_dummy: bool = False)¶
Iterable holding
ShapeExpr
s- Parameters:
length (int) – Number of dimensions of the tensor
- classmethod from_tuple(shape_exprs: Tuple[ShapeExpr | int]) ShapeExprs ¶
- Parameters:
shape_exprs (Tuple[Union[ShapeExpr, int]]) – Tuple to construct
ShapeExprs
from
- class tensorrt.plugin.SizeTensorShapeExpr(size_tensor_desc: SizeTensorDesc)¶
Extends
ShapeExpr
A shape expression that represent a size tensor
Note
It is recommended to use
SizeTensorDesc.expr
to get aSizeTensorShapeExpr
representing a size tensor