code: def sample_from_discretized_mix_logistic(y, log_scale_min=None):
      """
      Sample from discretized mixture of logistic distributions
      Args:
          y (Tensor): B x C x T
          log_scale_min (float): Log scale minimum value
      Returns:
          Tensor: sample in range of [-1, 1].
      """
      if log_scale_min is None:
          log_scale_min = float(np.log(1e-14))
      assert y.size(1) % 3 == 0
      nr_mix = y.size(1) // 3
  
      # B x T x C
      y = y.transpose(1, 2)
      logit_probs = y[:, :, :nr_mix]
  
      # sample mixture indicator from softmax
      temp = logit_probs.data.new(logit_probs.size()).uniform_(
          1e-5, 1.0 - 1e-5
      )
      temp = logit_probs.data - torch.log(-torch.log(temp))
      _, argmax = temp.max(dim=-1)
  
      # (B, T) -> (B, T, nr_mix)
      one_hot = to_one_hot(argmax, nr_mix)
      # select logistic parameters
      means = torch.sum(y[:, :, nr_mix : 2 * nr_mix] * one_hot, dim=-1)
      log_scales = torch.clamp(
          torch.sum(y[:, :, 2 * nr_mix : 3 * nr_mix] * one_hot, dim=-1),
          min=log_scale_min,
      )
      # sample from logistic & clip to interval
      # we don't actually round to the nearest 8bit value when sampling
      u = means.data.new(means.size()).uniform_(1e-5, 1.0 - 1e-5)
      x = means + torch.exp(log_scales) * (
          torch.log(u) - torch.log(1.0 - u)
      )
  
      x = torch.clamp(torch.clamp(x, min=-1.0), max=1.0)
  
      return x
  
file_path: TTS/TTS/vocoder/utils/distribution.py
imports: import numpy
  import math
  import torch
  from torch.distributions.normal import Normal
  import torch.nn.functional
label_desc: Use image node_id 5 for calling a global function with example usage: sample_from_discretized_mix_logistic(y, log_scale_min) and returns: x