code: def soft_dilate(img: torch.Tensor) -> torch.Tensor:  # type: ignore
      """
      Perform soft dilation on the input image
  
      Args:
          img: the shape should be BCH(WD)
  
      Adapted from:
          https://github.com/jocpae/clDice/blob/master/cldice_loss/pytorch/soft_skeleton.py#L18
      """
      if len(img.shape) == 4:
          return F.max_pool2d(img, (3, 3), (1, 1), (1, 1))
      elif len(img.shape) == 5:
          return F.max_pool3d(img, (3, 3, 3), (1, 1, 1), (1, 1, 1))
  
file_path: MONAI/monai/losses/cldice.py
imports: from __future__ import annotations
  import torch
  import torch.nn.functional
  from torch.nn.modules.loss import _Loss
label_desc: Use image node_id 2 for calling a global function with example usage: soft_dilate(img) and returns: F, F