How to convert tvm.relay.expr.Constant to int?

Hi all, I want to convert tvm.relay.expr.Constant() to int. which API is adapted to it. Thanks!

Would just accessing the data work? returns a tvm.nd.array, does that work? Then if you know the constant is just a scalar integer, you can verify that by checking and get its numpy value as

Also if you need just a plain integer (assuming == () is True), you can just access the value as[()].

1 Like

Thanks for you kindly reply! with your help, problem soved.

1 Like