tf.reshape 和 tf.transpose 用法
import tensorflow as tf
x= tf.constant(
[[2,3],[4,5],[6,7]],
tf.int32)
print(x.numpy())
[[2 3]
[4 5]
[6 7]]
x1=tf.reshape(x, shape = (tf.shape(x)[1], tf.shape(x)[0]))
print(x1.numpy())
[[2 3 4]
[5 6 7]]
x2=tf.transpose(x1)
print(x2.numpy())
[[2 5]
[3 6]
[4 7]]

浙公网安备 33010602011771号