Instruction of questions:
Below is my code:
# Instantiate a Sequential model
model = Sequential()
# Add a Dense layer with 50 neurons and an input of 1 neuron
model.add(Dense(50, input_shape=(2,), activation='relu'))
# Add two Dense layers with 50 neurons and relu activation
model.add(Dense(____,____=____))
model.____
# End your model with a Dense layer and no activation
model.____
I am confused about the part
model.add(Dense(____,____=____))
In model.add(Dense(___,___=___))
, you have three blanks. The first one is for mentioning number of neurons, the second one for saying that you want to set some value for activation
and the third one is for setting that value as relu
.
So you will get model.add(Dense(50,activation='relu'))
More information can be found in the Dense layer documentation .
In the documentation , the only required parameter for the Dense layer is units
, which is the number of neurons. The default activation function is None
, so if you want it to be "relu"
, do activation="relu"
.
In conclusion, this is that piece of code that creates a Dense layer with 50 neurons and activation as relu
:
model.add(Dense(50, activation="relu"))
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.