Saturday, 28 July 2018

How does this function create a deep neural network and not just rename the same variable?

I'm self learning from Geron's "Hands on Machine Learning" and I'm a little confused about how this function (in box [114] of the following page) creates a deep neural network.

https://github.com/ageron/handson-ml/blob/master/11_deep_learning.ipynb

he_init = tf.variance_scaling_initializer()

def dnn(inputs, n_hidden_layers=5, n_neurons=100, name=None,
        activation=tf.nn.elu, initializer=he_init):
    with tf.variable_scope(name, "dnn"):
        for layer in range(n_hidden_layers):
            inputs = tf.layers.dense(inputs, n_neurons, activation=activation,
                                     kernel_initializer=initializer,
                                     name="hidden%d" % (layer + 1))
        return inputs

It just looks like it resets the same input each time with a different name. Can someone explain how this is supposed to create a deep neural network?



from How does this function create a deep neural network and not just rename the same variable?

No comments:

Post a Comment