docstr: Compute the continuous-time label t in [0, T] of a given half-logSNR lambda_t.
docstr_tok: ["Compute","the","continuous-time","label","t","in","[","0",",","T","]","of","a","given","half-logSNR","lambda_t","."]
code: def inverse_lambda(self, lamb):
      """
      Compute the continuous-time label t in [0, T] of a given half-logSNR lambda_t.
      """
      if self.schedule == "linear":
          tmp = (
              2.0
              * (self.beta_1 - self.beta_0)
              * torch.logaddexp(-2.0 * lamb, torch.zeros((1,)).to(lamb))
          )
          Delta = self.beta_0**2 + tmp
          return (
              tmp
              / (torch.sqrt(Delta) + self.beta_0)
              / (self.beta_1 - self.beta_0)
          )
      elif self.schedule == "discrete":
          log_alpha = -0.5 * torch.logaddexp(
              torch.zeros((1,)).to(lamb.device), -2.0 * lamb
          )
          t = interpolate_fn(
              log_alpha.reshape((-1, 1)),
              torch.flip(self.log_alpha_array.to(lamb.device), [1]),
              torch.flip(self.t_array.to(lamb.device), [1]),
          )
          return t.reshape((-1,))
      else:
          log_alpha = -0.5 * torch.logaddexp(
              -2.0 * lamb, torch.zeros((1,)).to(lamb)
          )
  
          def t_fn(log_alpha_t):
              return (
                  torch.arccos(
                      torch.exp(log_alpha_t + self.cosine_log_alpha_0)
                  )
                  * 2.0
                  * (1.0 + self.cosine_s)
                  / math.pi
                  - self.cosine_s
              )
  
          t = t_fn(log_alpha)
          return t
  
imports: import math
  import torch
  from nemo.collections.multimodal.modules.stable_diffusion.diffusionmodules.util import expand_dims, interpolate_fn
label_desc: Use image node_id 6 for calling the NoiseScheduleVP obj's underlying member method code with example usage: obj.inverse_lambda(lamb) and returns: unknown, t, t, unknown