code: def blur(x, k):
      """
      x: image, NxcxHxW
      k: kernel, Nx1xhxw
      """
      n, c = x.shape[:2]
      p1, p2 = (k.shape[-2] - 1) // 2, (k.shape[-1] - 1) // 2
      x = torch.nn.functional.pad(
          x, pad=(p1, p2, p1, p2), mode="replicate"
      )
      k = k.repeat(1, c, 1, 1)
      k = k.view(-1, 1, k.shape[2], k.shape[3])
      x = x.view(1, -1, x.shape[2], x.shape[3])
      x = torch.nn.functional.conv2d(
          x, k, bias=None, stride=1, padding=0, groups=n * c
      )
      x = x.view(n, c, x.shape[2], x.shape[3])
  
      return x
  
imports: import random
  from functools import partial
  import albumentations
  import cv2
  import ldm.modules.image_degradation.utils_image
  import numpy
  import scipy
  import scipy.stats
  import torch
  from scipy import ndimage
  from scipy.interpolate import interp2d
  from scipy.linalg import orth
label_desc: Use image node_id 6 for calling a global function with example usage: blur(x, k) and returns: x