code: def connected_components_cpu(image: Tensor) -> Tensor:
      """Connected component labeling on CPU.
  
      Args:
          image (Tensor): Binary input data from which we want to extract connected components (Bx1xHxW)
  
      Returns:
          Tensor: Components labeled from 0 to N.
      """
      components = torch.zeros_like(image)
      label_idx = 1
      for i, mask in enumerate(image):
          mask = mask.squeeze().numpy().astype(np.uint8)
          _, comps = cv2.connectedComponents(mask)
          # remap component values to make sure every component has a unique value when outputs are concatenated
          for label in np.unique(comps)[1:]:
              components[i, 0, ...][
                  np.where(comps == label)
              ] = label_idx
              label_idx += 1
      return components.int()
  
imports: import cv2
  import numpy
  import torch
  from kornia.contrib import connected_components
  from torch import Tensor
label_desc: Use image node_id 2 for calling a global function with example usage: connected_components_cpu(image) and returns: components