What is the difference between tvm.var and tvm.relay.var?

Hello,

I’m a bit confused at tvm.var and tvm.relay.var. What’s major difference between these two data types? Current document is not very clear about this

Haichen

tvm.var produces a HalideIR variable while tvm.relay.var produces a Relay IR variable, so you use each one depending on what graph/ast you’re trying to construct. Halide and Relay nodes can’t be mixed.

Hi Joshpoll,
Can I say Relay IR is graph level IR, and Relay IR is converted into HalideIR by lowering ?
Thank you in advacne.

Yes, you’re correct.

1 Like

Why te.var stand for tensor index: i = te.var(“i”), C = te.compute(, lambda i: A[i] + B[i]). Well, Relay.var stand for tensor, a = relay.var, b = relay.var, c=relay.add(a, b)?