class_docstr: ## Sampler class
class_docstr_tok: ["#","#","Sampler","class"]
docstr: #### Generate images
docstr_tok: ["#","#","#","#","Generate","images"]
code: def sample(self, n_samples: int = 16):
      """
      #### Generate images
      """
      # $x_T \sim p(x_T) = \mathcal{N}(x_T; \mathbf{0}, \mathbf{I})$
      xt = torch.randn(
          [
              n_samples,
              self.image_channels,
              self.image_size,
              self.image_size,
          ],
          device=self.device,
      )
  
      # $$x_0 \sim \textcolor{lightgreen}{p_\theta}(x_0|x_t)$$
      x0 = self._sample_x0(xt, self.n_steps)
  
      # Show images
      for i in range(n_samples):
          self.show_image(x0[i])
  
file_path: annotated_deep_learning_paper_implementations/labml_nn/diffusion/ddpm/evaluate.py
imports: import numpy
  import torch
  from matplotlib import pyplot
  from torchvision.transforms.functional import to_pil_image, resize
  from labml import experiment, monit
  from labml_nn.diffusion.ddpm import DenoiseDiffusion, gather
  from labml_nn.diffusion.ddpm.experiment import Configs
label_desc: Use image node_id 8 for calling the Sampler obj's underlying member method code with example usage: obj.sample(n_samples) without return types