class_docstr: Inspired by: https://github.com/haofanwang/ControlNet-for-Diffusers/
class_docstr_tok: ["Inspired","by",":","https",":","\/\/github.com\/haofanwang\/ControlNet-for-Diffusers\/"]
code: def prepare_latents(
      self,
      batch_size,
      num_channels_latents,
      height,
      width,
      dtype,
      device,
      generator,
      latents=None,
  ):
      shape = (
          batch_size,
          num_channels_latents,
          height // self.vae_scale_factor,
          width // self.vae_scale_factor,
      )
      if isinstance(generator, list) and len(generator) != batch_size:
          raise ValueError(
              f"You have passed a list of generators of length {len(generator)}, but requested an effective batch"
              f" size of {batch_size}. Make sure the batch size matches the length of the generators."
          )
  
      if latents is None:
          latents = randn_tensor(
              shape, generator=generator, device=device, dtype=dtype
          )
      else:
          latents = latents.to(device)
  
      # scale the initial noise by the standard deviation required by the scheduler
      latents = latents * self.scheduler.init_noise_sigma
  
      return latents
  
imports: import inspect
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import numpy
  import PIL.Image
  import torch
  import torch.nn.functional
  from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer
  from diffusers import AutoencoderKL, ControlNetModel, DiffusionPipeline, UNet2DConditionModel, logging
  from diffusers.pipelines.controlnet.multicontrolnet import MultiControlNetModel
  from diffusers.pipelines.stable_diffusion import StableDiffusionPipelineOutput, StableDiffusionSafetyChecker
  from diffusers.schedulers import KarrasDiffusionSchedulers
  from diffusers.utils import PIL_INTERPOLATION, is_accelerate_available, is_accelerate_version, replace_example_docstring
  from diffusers.utils.torch_utils import randn_tensor
label_desc: Use image node_id 13 for calling the StableDiffusionControlNetInpaintPipeline obj's underlying member method code with example usage: obj.prepare_latents(batch_size, num_channels_latents, height, width, dtype, device, generator, latents) and returns: latents