[英]TensorFlow - tf.layers vs tf.contrib.layers
In TensorFlow, tf.layers
and tf.contrib.layers
share a lot of functionality (standard 2D convolutional layers, batch normalization layers, etc). 在TensorFlow中, tf.layers
和tf.contrib.layers
共享许多功能(标准2D卷积层,批量规范化层等)。 Is the difference between these two just that the contrib.layers
package is still experimental where the layers
package is considered stable? 这两者之间的区别仅在于contrib.layers
包仍然是实验性的,其中layers
包被认为是稳定的吗? Or is one being replaced by the other? 或者一个被另一个取代? Other differences? 其他差异? Why are these two separate? 为什么这两个分开?
You've answered your own question. 你已经回答了自己的问题。 The description on the official documentation for the tf.contrib
namespace is: tf.contrib
命名空间的官方文档说明如下:
contrib module containing volatile or experimental code. contrib模块包含volatile或实验代码。
So tf.contrib
is reserved for experimental features. 所以tf.contrib
保留用于实验性功能。 APIs in this namespace are allowed to change rapidly between versions, whereas the others usually can't without a new major version. 允许此命名空间中的API在不同版本之间快速更改,而其他API通常不能没有新的主要版本。 In particular, the functions in tf.contrib.layers
are not identical to those found in tf.layers
, although some of them might be replicated with different names. 特别是, tf.contrib.layers
中的函数与tf.contrib.layers
中的函数tf.layers
,尽管其中一些函数可能使用不同的名称进行复制。
As for whether you should use them, that depends on whether you are willing to handle sudden breaking changes. 至于你是否应该使用它们,这取决于你是否愿意处理突然发生的变化。 Code that doesn't rely on tf.contrib
may be easier to migrate to future versions of TensorFlow. 不依赖于tf.contrib
可能更容易迁移到TensorFlow的未来版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.