[Relay]How to get compute function of a specific operator in tvm.relay.frontend


#1

For example, I want to get compute function of ‘Relu’ operator in relay frontend for tensorflow, then I can use the following code to generate binary code of ‘Relu’ for specific target platform.

input = tvm.placeholder((1,3,16,16), name=‘input’, dtype=‘float32’)
output = tvm.compute((1,3,16,16), f_compute_relu)
s = tvm.create_schedule(output.op)
tvm.build(s, [input, output], “llvm”, name=‘relu’)

Here, f_compute_relu is the compute function I want to get from tvm.relay.frontend. Is it possible or is there some other method?

Is it possible to do cast between tvm.Tensor and tvm.relay.Expr?