code: def _filter2d(input, kernel):
      # prepare kernel
      b, c, h, w = input.shape
      tmp_kernel = kernel[:, None, ...].to(
          device=input.device, dtype=input.dtype
      )
  
      tmp_kernel = tmp_kernel.expand(-1, c, -1, -1)
  
      height, width = tmp_kernel.shape[-2:]
  
      padding_shape: list[int] = _compute_padding([height, width])
      input = torch.nn.functional.pad(
          input, padding_shape, mode="reflect"
      )
  
      # kernel and input tensor reshape to align element-wise or batch-wise params
      tmp_kernel = tmp_kernel.reshape(-1, 1, height, width)
      input = input.view(
          -1, tmp_kernel.size(0), input.size(-2), input.size(-1)
      )
  
      # convolve the tensor with the kernel.
      output = torch.nn.functional.conv2d(
          input,
          tmp_kernel,
          groups=tmp_kernel.size(0),
          padding=0,
          stride=1,
      )
  
      out = output.view(b, c, h, w)
      return out
  
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 5 for calling a global function with example usage: _filter2d(input, kernel) and returns: out