Is there an easy way to set input var shape and infer shape in Relay? It looks like infer_type requires type to be set when defining var.
We can simply rebind the var with a new one(with updated shape info) using bind, then call infer
import tvm
from tvm.relay.testing import resent
net, params = resnet.get_workload(num_layers=18, batch_size=1)
data_var = net.params[0]
out = tvm.relay.expr.bind(net, {data_var: tvm.relay.var("data", shape=[1, 3, 512, 512], dtype="float32")})
tvm.relay.ir_pass.infer_type(out)
This works for me. @tqchen Should I create a util function to deal with binding input shapes and dtypes?