code: def to_np(image):
      if isinstance(image[0], PIL.Image.Image):
          return np.stack([np.array(i) for i in image], axis=0)
      elif isinstance(image, torch.Tensor):
          return image.cpu().numpy().transpose(0, 2, 3, 1)
      return image
  
imports: import random
  import unittest
  from typing import Dict
  import numpy
  import PIL
  import pytest
  import torch
  from diffusers import OnnxStableDiffusionImg2ImgPipeline, StableDiffusionPipeline, StableDiffusionXLPipeline
  from diffusers.utils import load_image
  from diffusers.utils.testing_utils import floats_tensor
  from packaging.version import Version, parse
  from parameterized import parameterized
  from transformers.testing_utils import require_torch_gpu
  from utils_onnxruntime_tests import MODEL_NAMES, SEED, ORTModelTestMixin
  from optimum.onnxruntime import ORTLatentConsistencyModelPipeline, ORTStableDiffusionImg2ImgPipeline, ORTStableDiffusionInpaintPipeline, ORTStableDiffusionPipeline, ORTStableDiffusionXLImg2ImgPipeline, ORTStableDiffusionXLPipeline
  from optimum.onnxruntime.modeling_diffusion import ORTModelTextEncoder, ORTModelUnet, ORTModelVaeDecoder, ORTModelVaeEncoder
  from optimum.pipelines.diffusers.pipeline_utils import VaeImageProcessor
  from optimum.utils.import_utils import _diffusers_version
  from optimum.utils.testing_utils import grid_parameters, require_diffusers, require_ort_rocm
label_desc: Use image node_id 3 for calling a global function with example usage: to_np(image) and returns: image, np, image