docstr: Draw samples from a MoG.
docstr_tok: ["Draw","samples","from","a","MoG","."]
code: def sample(self, pi, sigma, mu):
      """Draw samples from a MoG."""
      categorical = Categorical(pi)
      pis = categorical.sample().unsqueeze(1)
      sample = Variable(sigma.data.new(sigma.size(0), 1).normal_())
      # Gathering from the n Gaussian Distribution based on sampled indices
      sample = sample * sigma.gather(1, pis) + mu.gather(1, pis)
      return sample
  
imports: import math
  import torch
  from omegaconf import DictConfig
  from torch import nn
  from torch.autograd import Variable
  from torch.distributions import Categorical
  from pytorch_tabular.models.common.heads import config
  from pytorch_tabular.utils import _initialize_layers, _linear_dropout_bn
label_desc: Use image node_id 6 for calling the MixtureDensityHead obj's underlying member method code with example usage: obj.sample(pi, sigma, mu) and returns: sample