TensorFlow 输出tensor数据
生活随笔
收集整理的這篇文章主要介紹了
TensorFlow 输出tensor数据
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
# Input icrf(tensor數據)
# Output out(float數據)
import tensorflow as tf
import numpy as npsess = 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数据的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 根据曲线上的采样点拟合直线
- 下一篇: Hololens2-OpenXR开发(一