class_docstr: Pipeline for text-to-image generation using Stable Diffusion without tokens length limit, and support parsing
  weighting in prompt.
  
  This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods the
  library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)
class_docstr_tok: ["Pipeline","for","text-to-image","generation","using","Stable","Diffusion","without","tokens","length","limit",",","and","support","parsing","weighting","in","prompt",".","This","model","inherits","from","[","`","DiffusionPipeline","`","]",".","Check","the","superclass","documentation","for","the","generic","methods","the","library","implements","for","all","the","pipelines","(","such","as","downloading","or","saving",",","running","on","a","particular","device",",","etc",".",")"]
code: def prepare_latents(
      self,
      image,
      timestep,
      batch_size,
      height,
      width,
      dtype,
      generator,
      latents=None,
  ):
      if image is None:
          shape = (
              batch_size,
              self.unet.config.in_channels,
              height // self.vae_scale_factor,
              width // self.vae_scale_factor,
          )
  
          if latents is None:
              latents = (
                  torch.randn(shape, generator=generator, device="cpu")
                  .numpy()
                  .astype(dtype)
              )
          else:
              if latents.shape != shape:
                  raise ValueError(
                      f"Unexpected latents shape, got {latents.shape}, expected {shape}"
                  )
  
          # scale the initial noise by the standard deviation required by the scheduler
          latents = (
              torch.from_numpy(latents)
              * self.scheduler.init_noise_sigma
          ).numpy()
          return latents, None, None
      else:
          init_latents = self.vae_encoder(sample=image)[0]
          init_latents = 0.18215 * init_latents
          init_latents = np.concatenate(
              [init_latents] * batch_size, axis=0
          )
          init_latents_orig = init_latents
          shape = init_latents.shape
  
          # add noise to latents using the timesteps
          noise = (
              torch.randn(shape, generator=generator, device="cpu")
              .numpy()
              .astype(dtype)
          )
          latents = self.scheduler.add_noise(
              torch.from_numpy(init_latents),
              torch.from_numpy(noise),
              timestep,
          ).numpy()
          return latents, init_latents_orig, noise
  
imports: import inspect
  import re
  from typing import Callable, List, Optional, Union
  import numpy
  import PIL.Image
  import torch
  from packaging import version
  from transformers import CLIPImageProcessor, CLIPTokenizer
  import diffusers
  from diffusers import OnnxRuntimeModel, OnnxStableDiffusionPipeline, SchedulerMixin
  from diffusers.pipelines.stable_diffusion import StableDiffusionPipelineOutput
  from diffusers.utils import logging
label_desc: Use image node_id 8 for calling the OnnxStableDiffusionLongPromptWeightingPipeline obj's underlying member method code with example usage: obj.prepare_latents(image, timestep, batch_size, height, width, dtype, generator, latents) and returns: latents,  None,  None, latents,  init_latents_orig,  noise