[solved][Relay] Broken case of type infer


#1
import tvm
import tvm.relay as relay
import numpy as np

x = relay.var("x", shape=(16,))
x1 = relay.var("x1", shape=(16,))
answer = relay.TypeVar("answer")
k = relay.Var("k", relay.FuncType([relay.TensorType((16,))], answer))
F = relay.Let(x1, x, relay.Call(k, [x1]))
F = relay.Function([x, k], F, type_params=[answer])
F = relay.ir_pass.infer_type(F)

ret = relay.var("ret", shape=(16,))
cont = relay.Function([ret], ret)

x = relay.var("x", shape=(16,))
F = relay.Call(F, [x, cont])

F = relay.Function([x], F)
F = relay.ir_pass.infer_type(F) # comment out this line then everything is fine

F = relay.ir_pass.to_a_normal_form(F)
F = relay.ir_pass.infer_type(F)

gives error

fn (%x: Tensor[(16,), float32]) -> Tensor[(16,), float32] {
  let %x1: meta[relay.IncompleteType][0] = fn (%ret: Tensor[(16,), float32]) -> Tensor[(16,), float32] {
    %ret
  }
  let %x2: meta[relay.IncompleteType][1] = fn <%answer>(%x3: Tensor[(16,), float32], %k: fn (Tensor[(16,), float32]) -> %answer) -> %answer {
    let %x4: meta[relay.IncompleteType][2] = let %x11: Tensor[(16,), float32] = %x3
    let %x5: meta[relay.IncompleteType][3] = %k(%x11)
    %x5
    %x4
  }
  let %x6: meta[relay.IncompleteType][4] = %x2(%x, %x1)Incorrect number of type args in (nullptr): 
Expected 0 but got 1

The error is possibly that x2 has no type params after Unify with IncompleteType in

@jroesch @MarisaKirisame


#2

solved in latest master


#3

yeah, we both hit the same error, lol