日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪(fǎng)問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

AttributeError: module 'tensorflow' has no attribute 'sub'

發(fā)布時(shí)間:2024/4/17 编程问答 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 AttributeError: module 'tensorflow' has no attribute 'sub' 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

?

官方的例子:運(yùn)行之后出現(xiàn)以下錯(cuò)誤

# 進(jìn)入一個(gè)交互式 TensorFlow 會(huì)話(huà). import tensorflow as tf sess = tf.InteractiveSession()x = tf.Variable([1.0, 2.0]) a = tf.constant([3.0, 3.0])# 使用初始化器 initializer op 的 run() 方法初始化 'x' x.initializer.run()# 增加一個(gè)減法 sub op, 從 'x' 減去 'a'. 運(yùn)行減法 op, 輸出結(jié)果 sub = tf.sub(x, a) print sub.eval() # ==> [-2. -1.]

?

Traceback (most recent call last):File "C:\Users\lzm\Desktop\ten-1.py", line 10, in <module>sub = tf.sub(x, a) AttributeError: module 'tensorflow' has no attribute 'sub'

?

出現(xiàn)這個(gè)問(wèn)題是因?yàn)閟ub函數(shù)換名字了,換成了subtract?

# 進(jìn)入一個(gè)交互式 TensorFlow 會(huì)話(huà). import tensorflow as tf sess = tf.InteractiveSession()x = tf.Variable([1.0, 2.0]) a = tf.constant([3.0, 3.0])# 使用初始化器 initializer op 的 run() 方法初始化 'x' x.initializer.run()# 增加一個(gè)減法 sub op, 從 'x' 減去 'a'. 運(yùn)行減法 op, 輸出結(jié)果 sub = tf.subtract(x, a) print sub.eval() # ==> [-2. -1.]

?

轉(zhuǎn)載于:https://www.cnblogs.com/QW-lzm/p/10499013.html

與50位技術(shù)專(zhuān)家面對(duì)面20年技術(shù)見(jiàn)證,附贈(zèng)技術(shù)全景圖

總結(jié)

以上是生活随笔為你收集整理的AttributeError: module 'tensorflow' has no attribute 'sub'的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。