code: def gaussian_blur_2d(img, kernel_size, sigma):
      ksize_half = (kernel_size - 1) * 0.5
  
      x = torch.linspace(-ksize_half, ksize_half, steps=kernel_size)
  
      pdf = torch.exp(-0.5 * (x / sigma).pow(2))
  
      x_kernel = pdf / pdf.sum()
      x_kernel = x_kernel.to(device=img.device, dtype=img.dtype)
  
      kernel2d = torch.mm(x_kernel[:, None], x_kernel[None, :])
      kernel2d = kernel2d.expand(
          img.shape[-3], 1, kernel2d.shape[0], kernel2d.shape[1]
      )
  
      padding = [
          kernel_size // 2,
          kernel_size // 2,
          kernel_size // 2,
          kernel_size // 2,
      ]
  
      img = F.pad(img, padding, mode="reflect")
      img = F.conv2d(img, kernel2d, groups=img.shape[-3])
  
      return img
  
imports: import inspect
  from typing import Any, Callable, Dict, List, Optional, Union
  import torch
  import torch.nn.functional
  from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer
  from ...image_processor import VaeImageProcessor
  from ...loaders import LoraLoaderMixin, TextualInversionLoaderMixin
  from ...models import AutoencoderKL, UNet2DConditionModel
  from ...models.lora import adjust_lora_scale_text_encoder
  from ...schedulers import KarrasDiffusionSchedulers
  from ...utils import USE_PEFT_BACKEND, deprecate, logging, replace_example_docstring, scale_lora_layers, unscale_lora_layers
  from ...utils.torch_utils import randn_tensor
  from ..pipeline_utils import DiffusionPipeline
  from .None import StableDiffusionPipelineOutput
  from .safety_checker import StableDiffusionSafetyChecker
label_desc: Use image node_id 1 for calling a global function with example usage: gaussian_blur_2d(img, kernel_size, sigma) and returns: img