import tensorflow as tf
a = tf.constant([1,2,3])
b = tf.constant([4,5,6])
# 矩阵拼接
c = tf.stack([a, b], axis=0) # 行拼接
# 矩阵分解
d = tf.unstack(c, axis=0) # 行,分解
e = tf.unstack(c, axis=1) # 列,分解
with tf.Session() as sess:
print(sess.run(c))
print(sess.run(d))
print(sess.run(e))
【TF 函数合集】- 【Tensor 拼接与分解】tf.stack() tf.unstack()
最新推荐文章于 2023-07-01 23:22:05 发布