简体   繁体   中英

tf cast leads to TypeError: Object of type 'int32' is not JSON serializable

I use tf.math.round() but the output still has decimal points (310.0, 210.0 etc) If I use tf.cast(tf.math.round(), dtype="int32"), then I see the error mentioned in the title when calling finish on tornado handler

How can I cast to int using tensorflow operations and still be json serielizable

You should use tf.int32 instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM