code: def _append_dims(x, target_dims):
      """Appends dimensions to the end of a tensor until it has target_dims dimensions."""
      dims_to_append = target_dims - x.ndim
      if dims_to_append < 0:
          raise ValueError(
              f"input has {x.ndim} dims but target_dims is {target_dims}, which is less"
          )
      return x[(...,) + (None,) * dims_to_append]
  
imports: import inspect
  from dataclasses import dataclass
  from typing import Callable, Dict, List, Optional, Union
  import numpy
  import PIL.Image
  import torch
  from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection
  from ...image_processor import VaeImageProcessor
  from ...models import AutoencoderKLTemporalDecoder, UNetSpatioTemporalConditionModel
  from ...schedulers import EulerDiscreteScheduler
  from ...utils import BaseOutput, logging
  from ...utils.torch_utils import is_compiled_module, randn_tensor
  from ..pipeline_utils import DiffusionPipeline
label_desc: Use image node_id 1 for calling a global function with example usage: _append_dims(x, target_dims) and returns: x