简体   繁体   中英

Difference between different tensorflow fully connected layers

What is the difference between the different fully connected layers available in tensorflow. I understand that there could 2 versions: Object oriented and functional, but I was able to find 4 different layers in tensorflow:

  1. tf.keras.layers.Dense
  2. tf.layers.dense
  3. tf.layers.Dense
  4. tf.contrib.layers.fully_connected

The documentation contains examples using all of them. I'd also like to know when to use each layer.

  1. Keras is a deep learning library which functions as a wrapper over 'lower level' languges such as Tensorflow and Theano. It has recently been integrated as a Tensorflow project and is part of the code-base. If you are using 'raw' Tensorflow, you should not use this layer.

  2. Tensorflow defines a functional interface. Layers and operations that are lowercase are typically part of this. These functions are used as building blocks when defining a custom layer or a loss function.

  3. This is the layer you should be using.

  4. This comes from the contrib library - features that are typically more experimental and volatile. Once a feature is deemed stable, you should use its other implementation (3). (4) will still be present in the library to maintain backwards compatability.

  1. Is a Keras wrapper function. Its functionality is same as 3. Checkout Keras .
  2. Its a functional interface for tensorflow.
  3. Commonly used.
  4. Function under development.

Technically speaking first 3 have same functionality (same inputs and outputs).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM