def validate_depth_map(depth_map: torch.Tensor | None) -> torch.Tensor | None:
        """Validate the depth map.

        This method validates and normalizes input depth maps. It handles:
            - 2D and 3D inputs
            - Single and multi-channel depth maps
            - Type conversion to float32

        Args:
            depth_map (``torch.Tensor`` | ``None``): Input depth map to validate.

        Returns:
            ``torch.Tensor`` | ``None``: Validated depth map as float32 tensor.

        Raises:
            TypeError: If ``depth_map`` is not a torch.Tensor.
            ValueError: If ``depth_map`` dimensions or channels are invalid.

        Example:
            Validate single-channel depth map::

                >>> import torch
                >>> from anomalib.data.validators import DepthValidator
                >>> depth_map = torch.rand(224, 224)  # [H, W]
                >>> validated = DepthValidator.validate_depth_map(depth_map)
                >>> validated.shape
                torch.Size([224, 224])
        """
        if depth_map is None:
            return None
        if not isinstance(depth_map, torch.Tensor):
            msg = f"Depth map must be a torch.Tensor, got {type(depth_map)}."
            raise TypeError(msg)
        if depth_map.ndim not in {2, 3}:
            msg = f"Depth map must have shape [H, W] or [C, H, W], got shape {depth_map.shape}."
            raise ValueError(msg)
        if depth_map.ndim == 3 and depth_map.shape[0] not in {1, 3}:
            msg = f"Depth map with 3 dimensions must have 1 or 3 channels, got {depth_map.shape[0]}."
            raise ValueError(msg)
        return depth_map.to(torch.float32)
Validate the depth map.

        This method validates and normalizes input depth maps. It handles:
            - 2D and 3D inputs
            - Single and multi-channel depth maps
            - Type conversion to float32

        Args:
            depth_map (``torch.Tensor`` | ``None``): Input depth map to validate.

        Returns:
            ``torch.Tensor`` | ``None``: Validated depth map as float32 tensor.

        Raises:
            TypeError: If ``depth_map`` is not a torch.Tensor.
            ValueError: If ``depth_map`` dimensions or channels are invalid.

        Example:
            Validate single-channel depth map::

                >>> import torch
                >>> from anomalib.data.validators import DepthValidator
                >>> depth_map = torch.rand(224, 224)  # [H, W]
                >>> validated = DepthValidator.validate_depth_map(depth_map)
                >>> validated.shape
                torch.Size([224, 224])
        
src/anomalib/data/validators/torch/depth.py