code: def alpha_sampler(
      self, x, i, encoder_hidden_states, guidance_scale=None, alpha=1
  ):
      # Algorithm 3
      t, t_next = self.heun_sigmas[i], self.heun_sigmas[i + 1]
      h = t_next - t
      d = (
          x - self.d_theta(x, t, encoder_hidden_states, guidance_scale)
      ) / t
      x_prime, t_prime = x + alpha * h * d, t + alpha * h
      if t_prime != 0:
          d_prime = (
              x_prime
              - self.d_theta(
                  x_prime,
                  t_prime,
                  encoder_hidden_states,
                  guidance_scale,
              )
          ) / t_prime
          x_next = x + h * (
              (1 - 0.5 / alpha) * d + 0.5 / alpha * d_prime
          )
      else:
          x_next = x + h * d
  
      return x_next
  
file_path: diffusion-for-beginners/samplers/heun.py
imports: import torch
  from math import sqrt
label_desc: Use image node_id 12 for calling the HeunSampler obj's underlying member method code with example usage: obj.alpha_sampler(x, i, encoder_hidden_states, guidance_scale, alpha) and returns: x_next