[SOLVED]How do I get the shape and dtype of “tvm.relay.expr.Var”


We have a definition where we can create a new “var“,like this
tvm.relay.expr. var ( *name_hint* , *type_annotation=None* , *shape=None* , *dtype='float32'* )
code is
x = tvm.relay.var("x", shape=[1, 2], dtype="float32")

Because the definition of ”Var“ is
*class*tvm.relay.expr.Var( *name_hint* , *type_annotation=None* )

So when I get ‘x’ ,How do I get its dtype and shape from ‘x’?

I try x.shape or x.dtype , but it doesn’t work

can anybody help me?

thanks a lot!


sumimasen,we can use x.type_annotation.dtype/shape .