

input_shape is a special argument, which the layer will accept only if it is designed as first layer in the model.Īlso, all Keras layer has few common methods and they are as follows − get_weightsįetch the full list of the weights used in the layer. Kernel_constraint represent constraint function to be applied to the kernel weights matrix.īias_constraint represent constraint function to be applied to the bias vector.Īs you have seen, there is no argument available to specify the input_shape of the input data. Kernel_regularizer represents the regularizer function to be applied to the kernel weights matrix.īias_regularizer represents the regularizer function to be applied to the bias vector.Īctivity_regularizer represents the regularizer function tp be applied to the output of the layer. Kernel_initializer represents the initializer to be used for kernel.īias_initializer represents the initializer to be used for the bias vector. Use_bias represents whether the layer uses a bias vector. Units represent the number of units and it affects the output layer.Īctivation represents the activation function. The argument supported by Dense layer is as follows − Layer_1.output_shape returns the output shape of the layer. Layer_1.input_shape returns the input shape of the layer. > from keras.layers import Activation, Dense Batch size is usually set during training phase. Currently, batch size is None as it is not set. All layer will have batch size as the first dimension and so, input shape will be represented by (None, 8) and the output shape as (None, 16). For example, if the input shape is (8,) and number of unit is 16, then the output shape is (16,). The output shape of the Dense layer will be affected by the number of neuron / units specified in the Dense layer. Result is the output and it will be passed into the next layer. As we learned earlier, linear activation does nothing. Kernel as 2 x 2 matrix, ]Īctivation as linear. Let us consider sample input and weights as below and try to find the result − Output = activation(dot(input, kernel) + bias)ĭot represent numpy dot product of all input and its corresponding weightsīias represent a biased value used in machine learning to optimize the modelĪctivation represent the activation function.

Dense layer does the below operation on the input and return the output. It is most common and frequently used layer. Dense layer is the regular deeply connected neural network layer.
