TensorFlow - tf.layers vs tf.contrib.layers

前端 未结 1 1337
暗喜
暗喜 2021-01-04 10:03

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 th

1条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-04 10:11

    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.

    0 讨论(0)
提交回复
热议问题