TensorFlow将float转成byte,byte转int
h = [[312312312.7],[321423423.4]]
h = tf.cast(h, dtype=tf.float32)
j = tf.bitcast(h, tf.int32)
print(j)
其中h中的 float是将int转成byte,再转成float32的,所以底层存的还是字节码,现在可以将其还原。
tf.Tensor(
[[1301605392]
[1301890114]], shape=(2, 1), dtype=int32)
...
原创
2021-09-19 17:00:32 ·
357 阅读 ·
0 评论