微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

AttributeError:模块“ keras.backend”没有属性“ common”

如何解决AttributeError:模块“ keras.backend”没有属性“ common”

我试图执行一些项目。但是我有一个attribute error。 我检查了Tensorflow和Keras版本。

Name: tensorflow
Version: 2.3.1
Name: Keras
Version: 2.4.3
Summary: Deep Learning for humans
python 3.8.2 

代码在这里

self.dim_ordering = K.common.image_dim_ordering()

错误消息:

self.dim_ordering = K.common.image_dim_ordering()
AttributeError: module 'keras.backend' has no attribute 'common'

可以使用K.image_data_format()代替k.common.image_dim_ordering()吗?

解决方法

是的。可以使用k.image_data_format()

在Keras v2中,该方法已重命名为image_data_format

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。