keras declare sequential model

Solutions on MaxInterview for keras declare sequential model by the best coders in the world

showing results for - "keras declare sequential model"
Anton
24 Oct 2019
1from keras.models import Sequential
2from keras.layers import Dense
3# NOTE: this is only how you declare a sequential model
4# Declare a sequential model by adding layers to it
5model = Sequential()
6# Adding layer with size 2 and input dimensions 1
7model.add(Dense(2, input_dim=1))
8# Output size of the model will be the size of the last layer
9model.add(Dense(1))
10# This can also be done by passing the layers as an array
11model2 = Sequential([Dense(2, input_dim=1), Dense(1)])
12# or even a mixture of both
13model2.add(Dense(1))