Is denseNet the same variable as model ? Looking at this snippet, it looks live you’re defining the optimizer with the parameters of denseNet, but calculating all losses and metrics on model, which will remain unchanged because of this error.