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

后端 未结 3 848
甜味超标
甜味超标 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:31

    tf.layers module is Tensorflow attempt at creating a Keras like API whereas tf.keras.layers is a compatibility wrapper. In fact, most of the implementation refers back to tf.layers, for example the tf.keras.layers.Dense inherits the core implementation:

    @tf_export('keras.layers.Dense')
    class Dense(tf_core_layers.Dense, Layer):
      # ...
    

    Because the tf.keras compatibility module is checked into the Tensorflow repo separately, it might lack behind what Keras actually offers. I would use Keras directly or tf.layers but not necessarily mix them.

提交回复
热议问题