examples/research_projects/vqgan-clip/loaders.py/reconstruct_with_vqgan
def reconstruct_with_vqgan(x, model):
    z, _, [_, _, indices] = model.encode(x)
    print(f"VQGAN --- {model.__class__.__name__}: latent shape: {z.shape[2:]}")
    xrec = model.decode(z)
    return xrec