I am working through a course on deep learning with Python and ran into this line:
hidden = Dense(2)(visible)
What does the second parameter do? Is this a python language feature I've missed?
I remember asking the same thing when I was learning Keras.
hidden = Dense(2)(visible)
You can rewrite this in a more verbose way as below:
dense_layer = Dense(2)
hidden = dense_layer(visible)
As you can see from the above, the first line creates an instance of the Dense layer, and then you can call that layer on a tensor. This adds the Dense operation to a graph of operations.
__call__ method, which allows you to call it like a function. Also if this answered your question, please accept it by clicking the green check mark.Visible is not a language specific feature or something. Your code should not have only this line but before that you probably define a variable named visible like below.
from keras.layers import Input
from keras.layers import Dense
visible = Input(shape=(2,))
hidden = Dense(2)(visible)
Here are some examples: