tensorflow.python.keras和tensorflow.keras有什么区别? [英] What's the difference between tensorflow.python.keras and tensorflow.keras?
问题描述
正如标题所述,它们是相同的api吗?当我在keras中打印layers模块时,结果如下所示:
As the title says, Are they the same api? When I print the layers module in keras, the result are shown as follow:
from tensorflow.keras import layers
print(layers)
from tensorflow.python.keras import layers
print(layers)
结果
<module 'tensorflow.python.keras.api._v1.keras.layers' from '/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/api/_v1/keras/layers/__init__.py'>
<module 'tensorflow.python.keras.layers' from '/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/layers/__init__.py'>
我们可以看到两个模块来自不同的来源.
We can see that two modules come from different source.
我从源代码中找到api模块,只有一个BUILD文件.
And I find the api module from source code, there is only a BUILD file.
两个模块之间是否存在关系,api生成器的机制是什么?
Is there a relation between two modules, what is the mechanism of the api generator?
推荐答案
tf.python.*
下的任何内容都是私有的,仅用于开发,而不用于公共用途.
Anything under tf.python.*
is private, intended for development only, rather than for public use.
不支持从tensorflow.python
或任何其他模块(包括import tensorflow_core
...)导入,并且可能会突然中断.
Importing from tensorflow.python
or any other modules (including import tensorflow_core
...) is not supported, and can break unannounced.
因此,建议不要在tf.python.*
中使用任何东西.
So, it is suggested not to use anything with tf.python.*
.
这篇关于tensorflow.python.keras和tensorflow.keras有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!