Template Function tvm::prim::TryConstFold(PrimExpr, PrimExpr)

Template Function tvm::prim::TryConstFold(PrimExpr, PrimExpr)#

Function Documentation#

template<typename Op>
inline ffi::Optional<PrimExpr> tvm::prim::TryConstFold(PrimExpr a, PrimExpr b)#

Try to run binary compute with constant folding.

Note

a and b Must already matched data types with each other.

Parameters:
  • a – The left operand.

  • b – The right operand.

Template Parameters:

Op – The operator type.

Returns:

std::nullopt if constant fold fails, otherwise return folded result.