Keras: what actually happens on Model creation and on model compile?

Viewed 31

What actually happens on model creation and on model compile? Why compile is not inside Model? What is happening in terms of tensorflow graph, session?

Example code:

# model creation
model = Model(inputs, outputs)

# model compile
model.compile(optimizer='adadelta', loss='binary_crossentropy')
1 Answers
model = Model(inputs, outputs)

The above statement groups the various layers together and defines the flow of data between the various layers. The optimizers, loss functions or metrics to be used for evaluation are not specified here.

model.compile(optimizer='adadelta', loss='binary_crossentropy')

The above statement, model.compile() is basically used to config the model with losses and metrics.

Related