class_docstr: Core ML version of
  `diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline`
class_docstr_tok: ["Core","ML","version","of","`","diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline","`"]
code: def run_controlnet(
      self,
      sample,
      timestep,
      encoder_hidden_states,
      controlnet_cond,
      output_dtype=np.float16,
  ):
      if not self.controlnet:
          raise ValueError(
              "Conditions for controlnet are given but the pipeline has no controlnet modules"
          )
  
      for i, (module, cond) in enumerate(
          zip(self.controlnet, controlnet_cond)
      ):
          module_outputs = module(
              sample=sample.astype(np.float16),
              timestep=timestep.astype(np.float16),
              encoder_hidden_states=encoder_hidden_states.astype(
                  np.float16
              ),
              controlnet_cond=cond.astype(np.float16),
          )
          if i == 0:
              outputs = module_outputs
          else:
              for key in outputs.keys():
                  outputs[key] += module_outputs[key]
  
      outputs = {k: v.astype(output_dtype) for k, v in outputs.items()}
  
      return outputs
  
imports: import argparse
  from diffusers import StableDiffusionPipeline, StableDiffusionXLPipeline
  from diffusers.pipelines.pipeline_utils import DiffusionPipeline
  from diffusers.pipelines.stable_diffusion import StableDiffusionPipelineOutput
  from diffusers.schedulers import DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, PNDMScheduler
  from diffusers.schedulers.scheduling_utils import SchedulerMixin
  import gc
  import inspect
  import logging
  import numpy
  import os
  from python_coreml_stable_diffusion.coreml_model import CoreMLModel, _load_mlpackage, _load_mlpackage_controlnet, get_available_compute_units
  import time
  import torch
  from transformers import CLIPFeatureExtractor, CLIPTokenizer
  from typing import List, Optional, Union, Tuple
  from PIL import Image
label_desc: Use image node_id 3 for calling the CoreMLStableDiffusionPipeline obj's underlying member method code with example usage: obj.run_controlnet(sample, timestep, encoder_hidden_states, controlnet_cond, output_dtype) and returns: outputs