简体   繁体   English

tensorflow.keras.layers 和 keras.layers 有什么区别?

[英]What is the difference between tensorflow.keras.layers and keras.layers?

I have read a related question's answer about this on stackoverflow which explains the difference between tensorflow.keras.layers and tensorflow.layers , link:我在 stackoverflow 上阅读了一个相关问题的答案,它解释了tensorflow.keras.layerstensorflow.layers之间的区别,链接:

What is the difference between tf.keras.layers versus tf.layers? tf.keras.layers 与 tf.layers 有什么区别?

But, it doesn't answer the difference between tensorflow.keras.layers and keras.layers , whereas I noticed I can import them also.但是,它没有回答tensorflow.keras.layerskeras.layers之间的区别,而我注意到我也可以导入它们。

So, what is the difference between them?那么,它们之间有什么区别呢?

Keras used to be able to support different backends (tensorflow, theano and CNTK). Keras 曾经能够支持不同的后端(tensorflow、theano 和 CNTK)。 Since keras 2.3, there is no difference between keras and tf.keras .从 keras 2.3 开始, kerastf.keras之间没有区别。

An excerpt from the Readme of the keras repository on github : github 上 keras 存储库自述文件的摘录:

Multi-backend Keras and tf.keras多后端 Keras 和 tf.keras

Multi-backend Keras has been discontinued.多后端 Keras 已停产。 At this time, we recommend that Keras users who use multi-backend Keras with the TensorFlow backend switch to tf.keras in TensorFlow 2.0.此时,我们建议使用多后端 Keras 和 TensorFlow 后端的 Keras 用户切换到 TensorFlow 2.0 中的 tf.keras。

Keras 2.2.5 was the last release of Keras implementing the 2.2.* API. Keras 2.2.5 是实现 2.2.* API 的最后一个 Keras 版本。 It was the last release to only support TensorFlow 1 (as well as Theano and CNTK).这是最后一个仅支持 TensorFlow 1(以及 Theano 和 CNTK)的版本。

The current release is Keras 2.4.0, which simply redirects to tf.keras.当前版本是 Keras 2.4.0,它只是重定向到 tf.keras。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM