Skip to content
BIASED

Implement reparameterization

Finish reparameterize: given mu and logvar =log⁡σ2= \log\sigma^2, draw ε∼N(0,I)\varepsilon \sim \mathcal N(0, I) and return z=μ+σ⊙εz = \mu + \sigma \odot \varepsilon. Everything should work element-wise on tensors of shape (batch, latent_dim).

The reparameterization trick

main.pyPython

Running Python arrives with the isolated execution service

Check results

Static check: the code is not executed. We read the assignments and compare the result with a reference at random values.

Unit tests (once the runner is live)

  • Output shape matches munot run
  • Sample mean and variance are close to μ and σ²not run
  • Gradients reach mu and logvarnot run
  • Works with different batch sizesnot run
  • Does not create tensors on another devicenot run