code: def _compute_tensor_center3d(tensor: torch.Tensor) -> torch.Tensor:
      """Compute the center of tensor plane for (D, H, W), (C, D, H, W) and (B, C, D, H, W)."""
      if not 3 <= len(tensor.shape) <= 5:
          raise AssertionError(
              f"Must be a 3D tensor as DHW, CDHW and BCDHW. Got {tensor.shape}."
          )
      depth, height, width = tensor.shape[-3:]
      center_x: float = float(width - 1) / 2
      center_y: float = float(height - 1) / 2
      center_z: float = float(depth - 1) / 2
      center: torch.Tensor = torch.tensor(
          [center_x, center_y, center_z],
          device=tensor.device,
          dtype=tensor.dtype,
      )
      return center
  
imports: from typing import Optional, Tuple, Union
  import torch
  from torch import nn
  from kornia.core import ones, ones_like, zeros
  from kornia.filters import gaussian_blur2d
  from kornia.utils import _extract_device_dtype
  from kornia.utils.image import perform_keep_shape_image
  from kornia.utils.misc import eye_like
  from .imgwarp import get_affine_matrix2d, get_projective_transform, get_rotation_matrix2d, warp_affine, warp_affine3d
label_desc: Use image node_id 2 for calling a global function with example usage: _compute_tensor_center3d(tensor) and returns: center