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]]
posted @ 2022-08-19 22:51  luoganttcc  阅读(27)  评论(0)    收藏  举报