as the question says, I would like to extract the model output for each input data during training. I thought it might be possible to easily extract the output of the forward pass during training, since it's calculated anyway, but couldn't figure out an efficient way to do it.
So I'm looking for a more efficient way to do the following:
for epoch in range(num_epochs):
model.fit(x_tr, y_tr, batch_size=batch_size, epochs=1)
y_pred = model.predict(x_tr, batch_size=batch_size)
# now I use y_pred for something before starting the next epoch
do_something_with_prediction(y_pred)
Custom Callbacks came into my mind, since they have build-in functions that get call e.g. on the end of each batch. But as far as I could find you can only access loss/metric values and not the actual output of the last layer.
Well I thought there must be a more efficient way, since the outputs get calculated on each forward-backward pass and I would really like to save the time to calculate the forward pass on the entire training data again.