If you were writing a loss function to be used by model.compile(), then the loss function would have to have the signature that keras expects: loss_fn(y_true, y_pred), but kl_reconstruction_loss() is just being called by our code to get a loss value that is then passed to model.add_loss(), so I see no reason that we should need those extra parameters.
I suspect those parameters are just left-over from an early implementation. I’ll let the course staff know so they can clean it up - or explain the reason for them if I’m missing something.
I tried to delete inputs and outputs from kl_reconstruction_loss and in the definition of vae_model change:
loss = kl_reconstruction_loss(inputs, z, mu, sigma)
to:
loss = kl_reconstruction_loss(mu, sigma)