What is the difference between tf.keras.layers versus tf.layers?

后端 未结 3 850
甜味超标
甜味超标 2021-01-04 21:01

What is the difference between tf.keras.layers versus tf.layers?
E.g. both of them have Conv2d, do they provide different outputs?
Is there any benefits if you mix

3条回答
  •  孤街浪徒
    2021-01-04 21:26

    Since TensorFlow 1.12, tf.layers are merely wrappers around tf.keras.layers.

    A few examples:

    Convolutional tf.layers just inherit from the convolutional tf.keras.layers, see source code here:

    @tf_export('layers.Conv2D')
    class Conv2D(keras_layers.Conv2D, base.Layer):
    

    The same is true for all core tf.layers, e.g.:

    @tf_export('layers.Dense')
    class Dense(keras_layers.Dense, base.Layer):
    

    With the integration of Keras into TensorFlow, it would make little sense to maintain several different layer implementations. tf.keras is becoming the de-facto high-level API for TensorFlow, therefore tf.layers are now just wrappers around tf.keras.layers.

提交回复
热议问题