TensorFlow 合并/连接数组的方法

yipeiwu_com5年前Python基础

如下所示:

import tensorflow as tf

a = tf.Variable([4,5,6])
b = tf.Variable([1,2,3])

c = tf.concat(0,[a,b])

init_op = tf.initialize_all_variables()

with tf.Session() as sess:
 sess.run(init_op)
 print(sess.run(c))

结果打印:

[4 5 6 1 2 3]

以上这篇TensorFlow 合并/连接数组的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持【听图阁-专注于Python设计】。

相关文章

django实现用户注册实例讲解

创建一个apps包 专门来放子应用 创建users子应用 处理用户事务 追加导包路径 在settings中用 print(sys.path) 查看现有导包路径 sys.path.i...

Python 将RGB图像转换为Pytho灰度图像的实例

问题: 我正尝试使用matplotlib读取RGB图像并将其转换为灰度。 在matlab中,我使用这个: img = rgb2gray(imread('image.png'));...

python ceiling divide 除法向上取整(或小数向上取整)的实例

向上取整的方法: 方法1: items = 102 boxsize = 10 num_boxes = (items + boxsize - 1) // boxsize 方法2:...

python-itchat 统计微信群、好友数量,及原始消息数据的实例

python-itchat 统计微信群、好友数量,及原始消息数据的实例

参考来自:https://itchat.readthedocs.io/zh/latest/api/ #coding=utf-8 import itchat from itchat.c...

Python 脚本获取ES 存储容量的实例

Python 脚本获取ES 存储容量的实例

最近有需求统计ES存储容量,之前用PHP实现的,考虑到以后可能会经常写脚本查询,故用python写了一个脚本,代码如下: import urllib import urllib2 i...