class_docstr: ## Configurations
class_docstr_tok: ["#","#","Configurations"]
docstr: ### Sample images
docstr_tok: ["#","#","#","Sample","images"]
code: def sample(self):
      """
      ### Sample images
      """
      with torch.no_grad():
          # $x_T \sim p(x_T) = \mathcal{N}(x_T; \mathbf{0}, \mathbf{I})$
          x = torch.randn(
              [
                  self.n_samples,
                  self.image_channels,
                  self.image_size,
                  self.image_size,
              ],
              device=self.device,
          )
  
          # Remove noise for $T$ steps
          for t_ in monit.iterate("Sample", self.n_steps):
              # $t$
              t = self.n_steps - t_ - 1
              # Sample from $\textcolor{lightgreen}{p_\theta}(x_{t-1}|x_t)$
              x = self.diffusion.p_sample(
                  x, x.new_full((self.n_samples,), t, dtype=torch.long)
              )
  
          # Log samples
          tracker.save("sample", x)
  
imports: from typing import List
  import torch
  import torch.utils.data
  import torchvision
  from PIL import Image
  from labml import lab, tracker, experiment, monit
  from labml.configs import BaseConfigs, option
  from labml_helpers.device import DeviceConfigs
  from labml_nn.diffusion.ddpm import DenoiseDiffusion
  from labml_nn.diffusion.ddpm.unet import UNet
label_desc: Use image node_id 2 for calling the Configs obj's underlying member method code with example usage: obj.sample() without return types