lixiaoquan opened a new pull request #6921: URL: https://github.com/apache/incubator-tvm/pull/6921
This PR is to fix a type inference issue: In Following IR, meta[relay.Constant][0] is a relay.Const with type TensorType([1, 4], "float32") ``` free_var %f: fn () -> bool; %0 = %f() /* ty=bool */; %1 = if (%0) { meta[relay.Constant][0] /* ty=Tensor[(?, ?), float32] */ } else { free_var %v0: Tensor[(2), float32]; dyn.full(0 /* ty=int32 */, %v0, shape=None, dtype="float32") /* ty=Tensor[(?, ?), float32] */ } /* ty=Tensor[(?, ?), float32] */; %2 = (%1,); concatenate(%2) /* ty=Tensor[(1, 4), float32] */ ``` the inferred type of `concatenate` is `Tensor[(1, 4), float32]`, but it should be Tensor[(?, ?), float32] because the type of `If` is Tensor[(?, ?), float32] With this PR: ``` free_var %f: fn () -> bool; %0 = %f() /* ty=bool */; %1 = if (%0) { meta[relay.Constant][0] /* ty=Tensor[(?, ?), float32] */ } else { free_var %v0: Tensor[(2), float32]; dyn.full(0 /* ty=int32 */, %v0, shape=None, dtype="float32") /* ty=Tensor[(?, ?), float32] */ } /* ty=Tensor[(?, ?), float32] */; %2 = (%1,); concatenate(%2) /* ty=Tensor[(?, ?), float32] */ ``` #3589 tried to add this TypeRelationFn but it isn't merged. @jroesch @icemelon9 @MarisaKirisame Could you please take a look? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org