复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18# Input icrf(tensor数据) # Output out(float数据) import tensorflow as tf import numpy as np sess = tf.Session() preinput = tf.placeholder(tf.float32, [None, None, None, 3]) ... rand_array = 初始化一个[None, None, 3]数组 out = sess.run(icrf, { preinput: [rand_array], is_training: False, }) print(out)
下面这个链接讲的挺好的
https://blog.csdn.net/kdongyi/article/details/82343712
简单地说,在run()前,需要feed_dict()初始化,才可以将tensor类型数据转换为自己想要的类型
Others:
如果输出的数组大小比较大,可能会出现省略号,可以在开头加上:
np.set_printoptions(threshold=np.inf)
输出到本地文件:
np.savetxt(‘file.txt’, iicrf, fmt=’%.2f’, delimiter=’n’)
(fmt=’%.2f’保留2位小数 'n’换行)
数组维度,形状,大小:
print('number of dim:',array.ndim) print('shape:', array.shape) print('size:', array.size)
tensorflow中获取shape的方法比较:
https://blog.csdn.net/yinxingtianxia/article/details/78121941
最后
以上就是愤怒河马最近收集整理的关于TensorFlow 输出tensor数据的全部内容,更多相关TensorFlow内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复