def vae_loss(input_motion, x): mse_loss = objectives.mse(input_motion, x) kl_loss = - 0.5 * K.mean(1 + z_log_std - K.square(z_mean) - K.exp(z_log_std)) return mse_loss + 0.5 * kl_loss