You are viewing a plain text version of this content. The canonical link for it is here.
Posted to discuss-archive@tvm.apache.org by "tqchen (via GitHub)" <gi...@apache.org> on 2026/07/16 00:19:42 UTC

Re: [PR] [REFACTOR] Remove redundant defensive code guaranteed by IR invariants [tvm]

tqchen commented on code in PR #20011:
URL: https://github.com/apache/tvm/pull/20011#discussion_r3591650146


##########
src/relax/analysis/well_formed.cc:
##########
@@ -167,7 +167,7 @@ class WellFormedChecker : public relax::ExprVisitor, public relax::TypeVisitor {
 
   void VisitExpr(const Expr& expr) final {
     if (!expr.as<OpNode>() && expr->ty.IsMissing()) {

Review Comment:
   This diff only changes the diagnostic wording ("is nullptr" -> "is missing"); the `!expr.as<OpNode>() && expr->ty.IsMissing()` guard is pre-existing and unchanged. The concern is also not applicable here: `WellFormedChecker::VisitExpr` is only ever reached with defined relax expressions (an undefined `Expr` would already fault at `expr->ty` regardless of this guard, and the visitor never enqueues one). Adding an `expr.defined()` check would re-verify an IR invariant this cleanup pass is specifically removing, so no code change is made.
   



##########
tests/python/relax/test_op_gradient_numeric.py:
##########
@@ -36,7 +36,6 @@ def relax_check_gradients(
     op_func: Callable,
     inputs_numpy: list[np.array],

Review Comment:
   Applied: the parameter annotation is now `list[np.ndarray]`.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org