The model definition is independent from recording the loss and accuracy so could you explain the issue a bit more, please?
PS: you can post code snippets by wrapping them into three backticks ```, which would make debugging easier.