keras和tf.keras有什么区别? [英] What is the difference between keras and tf.keras?
问题描述
我正在学习TensorFlow和Keras.我想尝试 https://www.amazon. com/Deep-Learning-Python-Francois-Chollet/dp/1617294438/,它似乎是用Keras编写的.
I'm learning TensorFlow and Keras. I'd like to try https://www.amazon.com/Deep-Learning-Python-Francois-Chollet/dp/1617294438/, and it seems to be written in Keras.
将代码转换为tf.keras
是否相当简单?
Would it be fairly straightforward to convert code to tf.keras
?
我对代码的可移植性并不感兴趣,而不是两者之间的真正区别.
I'm not more interested in the portability of the code, rather than the true difference between the two.
推荐答案
在这一点上,tensorflow几乎完全采用了keras API,并且有一个很好的理由-它简单,易用且易于学习,而纯" tensorflow带有很多样板代码.是的,您可以使用tf.keras而不会出现任何问题,尽管您可能必须在代码中重新处理导入.例如
At this point tensorflow has pretty much entirely adopted the keras API and for a good reason - it's simple, easy to use and easy to learn, whereas "pure" tensorflow comes with a lot of boilerplate code. And yes, you can use tf.keras without any issues, though you might have to re-work your imports in the code. For instance
from keras.layers.pooling import MaxPooling2D
将变成:
from tensorflow.keras.layers import MaxPooling2D
这篇关于keras和tf.keras有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!