Deeply compare two nested expressions. Parameters ---------- lhs : PrimExpr The left operand. rhs : PrimExpr The right operand. Returns ------- result : bool The comparison result Note ---- This function does not remap variable bin
(lhs: PrimExpr, rhs: PrimExpr)
| 28 | |
| 29 | |
| 30 | def expr_deep_equal(lhs: PrimExpr, rhs: PrimExpr) -> bool: |
| 31 | """Deeply compare two nested expressions. |
| 32 | |
| 33 | Parameters |
| 34 | ---------- |
| 35 | lhs : PrimExpr |
| 36 | The left operand. |
| 37 | |
| 38 | rhs : PrimExpr |
| 39 | The right operand. |
| 40 | |
| 41 | Returns |
| 42 | ------- |
| 43 | result : bool |
| 44 | The comparison result |
| 45 | |
| 46 | Note |
| 47 | ---- |
| 48 | |
| 49 | This function does not remap variable bindings, it will not |
| 50 | return true for (let x = 1 in x + 1) vs (let y = 1 in y + 1), unless x.same_as(y). |
| 51 | Use py:func:`tvm_ffi.structural_equal` to handle structural variable remapping. |
| 52 | |
| 53 | Due to the restriction of not remapping variables, this function can run |
| 54 | faster than StructuralEqual and can be used as a utility function during arithmetic |
| 55 | simplifications. |
| 56 | |
| 57 | Always consider py:func:`tvm_ffi.structural_equal` first, which handles |
| 58 | the structural remapping. |
| 59 | |
| 60 | See Also |
| 61 | -------- |
| 62 | tvm_ffi.structural_equal |
| 63 | """ |
| 64 | return _ffi_api.expr_deep_equal(lhs, rhs) # type: ignore |
| 65 | |
| 66 | |
| 67 | def verify_ssa(func: PrimFunc) -> bool: |
no outgoing calls
searching dependent graphs…