tensorflowneural-networktf-slim

TF-slim layers count


Would the code below represent one or two layers? I'm confused because isn't there also supposed to be an input layer in a neural net?

input_layer = slim.fully_connected(input, 6000, activation_fn=tf.nn.relu)
output = slim.fully_connected(input_layer, num_output)

Does that contain a hidden layer? I'm just trying to be able to visualize the net. Thanks in advance!


Solution

  • enter image description here

    You have a neural network with one hidden layer. In your code, input corresponds to the 'Input' layer in the above image. input_layer is what the image calls 'Hidden'. output is what the image calls 'Output'.

    Remember that the "input layer" of a neural network isn't a traditional fully-connected layer since it's just raw data without an activation. It's a bit of a misnomer. Those neurons in the picture above in the input layer are not the same as the neurons in the hidden layer or output layer.