更新时间:2023-12-02 14:26:22
在这一点上,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