繁体   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