简体   繁体   English

AttributeError: 模块 'tensorflow.keras.models' 没有属性 'experimental'

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

I am attempting to use the tf.keras.models.experimental.SharpnessAwareMinimization class from tf-nightly.我正在尝试使用 tf-nightly 中的tf.keras.models.experimental.SharpnessAwareMinimization class。 I installed tf-nightly with pip install tf-nightly and tf-nightly-gpu with pip install tf-nightly-gpu .我用pip install tf-nightly和 tf-nightly-gpu 安装了pip install tf-nightly-gpu

Then, I import tensorflow with import tensorflow as tf .然后,我将 tensorflow import tensorflow as tf May I know how to proceed from here?我可以知道如何从这里开始吗?

tf.__vesion__ is 2.9.1 tf.__vesion__是 2.9.1

I am able to run this code and import SharpnessAwareMinimization api successfully and it shows below tensorflow version:我能够运行此代码并成功导入SharpnessAwareMinimization api,它显示以下 tensorflow 版本:

!pip install tf_nightly

import tensorflow as tf
tf.__version__

from tensorflow.keras.models.experimental import SharpnessAwareMinimization

Output: (I got the same output in Google colab and Jupyter notebook ) Output:(我在Google colabJupyter notebook中得到了相同的 output)

2.11.0-dev20220806

Please run this code again !pip install tf_nightly and retstart the kernel (runtime).请再次运行此代码!pip install tf_nightly并重新启动 kernel(运行时)。 Check again the tensorflow version and let us know if the issue still persists.再次检查 tensorflow 版本,如果问题仍然存在,请告知我们。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AttributeError:模块'tensorflow.keras.models'没有属性'sequential' - AttributeError: module 'tensorflow.keras.models' has no attribute 'sequential' AttributeError: 模块 'tensorflow.io' 没有属性 'experimental' - AttributeError: module 'tensorflow.io' has no attribute 'experimental' AttributeError:模块“ tensorflow”没有属性“ keras” - AttributeError: module 'tensorflow' has no attribute 'keras' tensorflow.keras.models遇到错误 - tensorflow.keras.models running into error AttributeError: tensorflow_core.python.keras.api._v2.keras.layers.experimental' has no attribute 'SyncBatchNormalization' - AttributeError: tensorflow_core.python.keras.api._v2.keras.layers.experimental' has no attribute 'SyncBatchNormalization' AttributeError: 模块 'tensorflow' 没有属性 'placeholder' 与 keras 2.2.4 tensorflow 1.14 - AttributeError: module 'tensorflow' has no attribute 'placeholder' with keras 2.2.4 tensorflow 1.14 AttributeError: module 'tensorflow' has no attribute 'python' in Keras Tensorflow - AttributeError: module 'tensorflow' has no attribute 'python' in Keras Tensorflow AttributeError:模块“keras.api._v2.keras.experimental”没有属性“export_saved_model” - AttributeError: module 'keras.api._v2.keras.experimental' has no attribute 'export_saved_model' AttributeError: 模块“tensorflow”在 Keras 中没有属性“name_scope” - AttributeError: module 'tensorflow' has no attribute 'name_scope' with Keras AttributeError:模块“tensorflow.python.keras”没有属性“应用程序” - AttributeError: module 'tensorflow.python.keras' has no attribute 'applications'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM