函数

tensorrt.plugin.cdiv(first: int | ShapeExpr, second: int | ShapeExpr) ShapeExpr

计算 first 除以 second 的符号上限除法

参数:
引发:

ValueError – 如果两个参数都是 int 或如果 second 的计算结果为 0

返回:

用于 first 除以 second 的上限除法的符号表达式

返回类型:

ShapeExpr

tensorrt.plugin.max(first: int | ShapeExpr, second: int | ShapeExpr) ShapeExpr

计算 firstsecond 的最大值

参数:
  • first (Union[int, ShapeExpr]) – 第一个操作数

  • second (Union[int, ShapeExpr]) – 第二个操作数

引发:

ValueError – 如果两个参数都是 int

返回:

用于 firstsecond 的最大值的符号表达式

返回类型:

ShapeExpr

tensorrt.plugin.min(first: int | ShapeExpr, second: int | ShapeExpr) ShapeExpr

计算 firstsecond 的最小值

参数:
  • first (Union[int, ShapeExpr]) – 第一个操作数

  • second (Union[int, ShapeExpr]) – 第二个操作数

引发:

ValueError – 如果两个参数都是 int

返回:

用于 firstsecond 的最小值的符号表达式

返回类型:

ShapeExpr

tensorrt.plugin.size_tensor(opt: ShapeExpr, upper_bound: ShapeExpr) SizeTensorDesc

使用指定的自动调优形状表达式 optupper_bound 构造大小张量

参数:
  • opt (ShapeExpr) – 用于引擎构建的自动调优过程中的此大小张量范围的符号表达式

  • upper_bound (ShapeExpr) – 此大小张量的上限的符号表达式

返回:

具有指定自动调优范围和上限的大小张量的张量描述符

返回类型:

SizeTensorDesc

tensorrt.plugin.from_shape_expr(shape_expr: Tuple[ShapeExpr | int] | ShapeExprs, dtype: DataType) TensorDesc

使用指定的形状表达式和数据类型构造张量描述符

参数:
  • shape_expr (Union[Tuple[Union[ShapeExpr, int]], ShapeExprs]) – 表示张量形状的表达式或常量

  • dtype (trt.DataType) – 张量的数据类型

返回:

具有指定形状表达式和数据类型的张量描述符

返回类型:

TensorDesc