[Relay]Similar functionality of graph infer_shape in nnvm


#1

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.


#2

We can simply rebind the var with a new one(with updated shape info) using bind, then call infer


#3
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?