tf.concat
来源:互联网 发布:尼康关闭中国工厂知乎 编辑:程序博客网 时间:2024/05/22 04:34
show codes:
import tensorflow as tft1 = [[[1, 1, 1],[2, 2, 2]],[[3, 3, 3],[4, 4, 4]]]t2 = [[[5, 5, 5],[6, 6, 6]],[[7, 7, 7],[8, 8, 8]]]with tf.Session() as sess: A = tf.concat(0, [t1, t2]) B = tf.concat(1, [t1, t2]) C = tf.concat(2, [t1, t2]) print(sess.run(A)) print('---------------------------------------------------------') print(sess.run(B)) print('---------------------------------------------------------') print(sess.run(C))
result:
具体来讲:
concat沿着某一维度链接tensor, 需要理解tensor 的维度
t1 = [[[1, 1, 1],[2, 2, 2]],[[3, 3, 3],[4, 4, 4]]]
t2 = [[[5, 5, 5],[6, 6, 6]],[[7, 7, 7],[8, 8, 8]]]
第0维解释:
t1和t2的0维是两个tensor最外层的两个中括号, 所以 tf.concat(0, [t1,t2]), 就是将t1 和 t2的最外层中括号去掉,元素合在一起在最外层再加一个中括号即可
第1维解释:
t1和t2的1维中第一个元素分别是:[[1, 1, 1],[2, 2, 2]] 和 [[5, 5, 5],[6, 6, 6]], 分别把外层中括号去掉合在一起,即为[1, 1, 1], [2, 2, 2], [5, 5, 5], [6, 6, 6] 然后外层在加一个中括号即可[[1, 1, 1], [2, 2, 2], [5, 5, 5], [6, 6, 6]]
第2维解释:
t1和t2的2维中的第一个元素分别为[1, 1, 1] 和 [5, 5, 5],两者合并后即为 [1, 1, 1, 5, 5, 5]
参考资料:
http://blog.csdn.net/helei001/article/details/51363706
http://blog.csdn.net/mao_xiao_feng/article/details/53366163
0 0
- tf.concat
- tf.concat
- tf.concat()
- tensorflow tf.concat操作
- tf.concat的用法
- tf.concat的用法
- 【TensorFlow】tf.concat
- tf.concat的用法
- tf.concat说明
- 【Tensorflow】tf.concat函数
- tensorflow API: tf.concat
- 【TensorFlow】tf.concat的用法
- tf.concat与numpy.concatenate
- tensorflow错误记录:tf.concat
- tensorflow错误记录:tf.concat
- tensorflow 中tf.concat()用法
- tensorflow错误记录:tf.concat
- tf.concat (API r1.3)
- android_Class_Color
- [leetcode]: 461. Hamming Distance
- Android APP启动时出现白屏或者黑屏怎么办?
- hadoop2.4.1集群搭建
- 霍纳法则(horner)
- tf.concat
- Java反射机制详解
- NYOJ64 鸡兔同笼
- 机器学习-周志华著-笔记
- 二维数组中的查找
- 堆排序
- YUM 软件管理
- Hibernate一对多关联操作
- Android事件处理