code: def training_losses(
      self, model, x_start, sigmas, model_kwargs=None, noise=None
  ):
      if model_kwargs is None:
          model_kwargs = {}
      if noise is None:
          noise = th.randn_like(x_start)
  
      terms = {}
  
      dims = x_start.ndim
      x_t = x_start + noise * append_dims(sigmas, dims)
      model_output, denoised = self.denoise(
          model, x_t, sigmas, **model_kwargs
      )
  
      snrs = self.get_snr(sigmas)
      weights = append_dims(
          get_weightings(self.weight_schedule, snrs, self.sigma_data),
          dims,
      )
      terms["xs_mse"] = mean_flat((denoised - x_start) ** 2)
      terms["mse"] = mean_flat(weights * (denoised - x_start) ** 2)
  
      if "vb" in terms:
          terms["loss"] = terms["mse"] + terms["vb"]
      else:
          terms["loss"] = terms["mse"]
  
      return terms
  
imports: import random
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from piq import LPIPS
  from torchvision.transforms import RandomCrop
  from .None import dist_util
  from .nn import mean_flat, append_dims, append_zero
  from .random_util import get_generator
label_desc: Use image node_id 6 for calling the KarrasDenoiser obj's underlying member method code with example usage: obj.training_losses(model, x_start, sigmas, model_kwargs, noise) and returns: terms