簡體   English   中英

AttributeError: 模塊 'tensorflow.keras.models' 沒有屬性 'experimental'

[英]AttributeError: module 'tensorflow.keras.models' has no attribute 'experimental'

我正在嘗試使用 tf-nightly 中的tf.keras.models.experimental.SharpnessAwareMinimization class。 我用pip install tf-nightly和 tf-nightly-gpu 安裝了pip install tf-nightly-gpu

然后,我將 tensorflow import tensorflow as tf 我可以知道如何從這里開始嗎?

tf.__vesion__是 2.9.1

我能夠運行此代碼並成功導入SharpnessAwareMinimization api,它顯示以下 tensorflow 版本:

!pip install tf_nightly

import tensorflow as tf
tf.__version__

from tensorflow.keras.models.experimental import SharpnessAwareMinimization

Output:(我在Google colabJupyter notebook中得到了相同的 output)

2.11.0-dev20220806

請再次運行此代碼!pip install tf_nightly並重新啟動 kernel(運行時)。 再次檢查 tensorflow 版本,如果問題仍然存在,請告知我們。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM