class_docstr: Stochastic sampling from Karras et al. [1] tailored to the Variance-Expanding (VE) models [2]. Use Algorithm 2 and
  the VE column of Table 1 from [1] for reference.
  
  [1] Karras, Tero, et al. "Elucidating the Design Space of Diffusion-Based Generative Models."
  https://arxiv.org/abs/2206.00364 [2] Song, Yang, et al. "Score-based generative modeling through stochastic
  differential equations." https://arxiv.org/abs/2011.13456
class_docstr_tok: ["Stochastic","sampling","from","Karras","et","al",".","[","1","]","tailored","to","the","Variance-Expanding","(","VE",")","models","[","2","]",".","Use","Algorithm","2","and","the","VE","column","of","Table","1","from","[","1","]","for","reference",".","[","1","]","Karras",",","Tero",",","et","al",".","``","Elucidating","the","Design","Space","of","Diffusion-Based","Generative","Models",".","''","https",":","\/\/arxiv.org\/abs\/2206.00364","[","2","]","Song",",","Yang",",","et","al",".","``","Score-based","generative","modeling","through","stochastic","differential","equations",".","''","https",":","\/\/arxiv.org\/abs\/2011.13456"]
docstr: Explicit Langevin-like "churn" step of adding noise to the sample according to a factor gamma_i ≥ 0 to reach a
  higher noise level sigma_hat = sigma_i + gamma_i*sigma_i.
docstr_tok: ["Explicit","Langevin-like","``","churn","''","step","of","adding","noise","to","the","sample","according","to","a","factor","gamma_i","\u2265","0","to","reach","a","higher","noise","level","sigma_hat","=","sigma_i","+","gamma_i","*","sigma_i","."]
code: def add_noise_to_input(self, sample, sigma, generator=None):
      """
      Explicit Langevin-like "churn" step of adding noise to the sample according to a factor gamma_i ≥ 0 to reach a
      higher noise level sigma_hat = sigma_i + gamma_i*sigma_i.
      """
      if self.s_min <= sigma <= self.s_max:
          gamma = min(
              self.s_churn / self.num_inference_steps, 2**0.5 - 1
          )
      else:
          gamma = 0
  
      # sample eps ~ N(0, S_noise^2 * I)
      eps = self.s_noise * paddle.randn(sample.shape)
      sigma_hat = sigma + gamma * sigma
      sample_hat = sample + ((sigma_hat**2 - sigma**2) ** 0.5 * eps)
  
      return sample_hat, sigma_hat
  
file_path: PaddleHub/modules/image/text_to_image/stable_diffusion_inpainting/diffusers/schedulers/scheduling_karras_ve.py
imports: from typing import Union
  import numpy
  import paddle
  from ..configuration_utils import ConfigMixin
  from ..configuration_utils import register_to_config
  from .scheduling_utils import SchedulerMixin
label_desc: Use image node_id 3 for calling the KarrasVeScheduler obj's underlying member method code with example usage: obj.add_noise_to_input(sample, sigma, generator) and returns: sample_hat,  sigma_hat