Reputation: 12404
In TensorFlow, tf.layers
and tf.contrib.layers
share a lot of functionality (standard 2D convolutional layers, batch normalization layers, etc). Is the difference between these two just that the contrib.layers
package is still experimental where the layers
package is considered stable? Or is one being replaced by the other? Other differences? Why are these two separate?
Upvotes: 12
Views: 6045
Reputation: 29993
You've answered your own question. The description on the official documentation for the tf.contrib
namespace is:
contrib module containing volatile or experimental code.
So tf.contrib
is reserved for experimental features. APIs in this namespace are allowed to change rapidly between versions, whereas the others usually can't without a new major version. 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.
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.
Upvotes: 16