tensorflow调用问题解决
生活随笔
收集整理的這篇文章主要介紹了
tensorflow调用问题解决
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
做特征點匹配項目的時候用到了tensorflow,但是在導入tensorflow模塊的時候出現了以下的問題:
FutureWarning: Passing (type, 1) or ‘1type’ as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / ‘(1,)type’.
我們根據終端輸出的提示,打開dtypes.py的523-527、532行代碼,在未來的numpy版本中當前的語句可能會被誤解(我安裝的是tensorflow12.0版本),于是我們將對應的語句修改,也就是
分別將_np_qint8 = np.dtype([(“qint8”,np.uint8, 1)])
修改為:
_np_qint8 = np.dtype([(“qint8”, np.int8, (1,))])
寫一段簡單的代碼測試一下是否成功解決這個bug,代碼如下:
#導入tensorflow模塊 import tensorflow as tf#定義一個常量字符串hello hello=tf.constant('Hello, it is my first tensorflow code!')#定義Session,執行計算圖 sess=tf.Session() print(sess.run(hello))終端輸出為:
b'Hello, it is my first tensorflow code!'測試成功!
總結
以上是生活随笔為你收集整理的tensorflow调用问题解决的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 如何更合理地选择图表形式
- 下一篇: tensorflow安装教程 win