hidet.ir.expr

Classes:

IfThenElse(cond, then_expr, else_expr)

The if-then-else expression.

Functions:

if_then_else(cond, then_expr, else_expr)

Create an if-then-else expression.

tensor_slice(base, indices, starts, ends)

Create a tensor slice expression.

class hidet.ir.expr.IfThenElse(cond, then_expr, else_expr)[source]

The if-then-else expression.

Parameters:
  • cond (Expr) – The condition of the if-then-else expression.

  • then_expr (Expr) – The expression to be evaluated if the condition is true.

  • else_expr (Expr) – The expression to be evaluated if the condition is false.

hidet.ir.expr.Int(*args, **kwargs)

The following are the mapping from hidet expression class to corresponding python operator. Used by compilation-time constant folding.

alias of Union[int, Expr]

hidet.ir.expr.if_then_else(cond, then_expr, else_expr)[source]

Create an if-then-else expression.

Parameters:
  • cond (Expr or PyScalar) – The condition of the if-then-else expression.

  • then_expr (Expr or PyScalar) – The expression to be evaluated if the condition is true.

  • else_expr (Expr or PyScalar) – The expression to be evaluated if the condition is false.

Returns:

ret – The if-then-else expression.

Return type:

Expr

hidet.ir.expr.tensor_slice(base, indices, starts, ends)[source]

Create a tensor slice expression.

Parameters:
  • base (Expr) – The base tensor expression.

  • indices (Sequence[Optional[Int]]) – The indices of the tensor slice.

  • starts (Sequence[Optional[Int]]) – The start indices of the tensor slice.

  • ends (Sequence[Optional[Int]]) – The end indices of the tensor slice.

Returns:

ret – The tensor slice expression.

Return type:

TensorSlice