The VQ-VAE loss has three parts: reconstruction, a codebook term that moves codes toward encoder outputs, and a commitment term that keeps encoder outputs near their codes. The two quantization terms share a squared-distance form.
Implement vq_loss(z, e, beta), returning the mean squared distance scaled by (1 + beta).
Compute the mean squared difference between encoder outputs and codes, then weight it by 1 + beta.
No results yet
Run your code to check it against the examples, or submit to run every test.