code: def bgr_to_grayscale(image: Tensor) -> Tensor:
      r"""Convert a BGR image to grayscale.
  
      The image data is assumed to be in the range of (0, 1). First flips to RGB, then converts.
  
      Args:
          image: BGR image to be converted to grayscale with shape :math:`(*,3,H,W)`.
  
      Returns:
          grayscale version of the image with shape :math:`(*,1,H,W)`.
  
      Example:
          >>> input = torch.rand(2, 3, 4, 5)
          >>> gray = bgr_to_grayscale(input) # 2x1x4x5
      """
      KORNIA_CHECK_IS_TENSOR(image)
  
      if len(image.shape) < 3 or image.shape[-3] != 3:
          raise ValueError(
              f"Input size must have a shape of (*, 3, H, W). Got {image.shape}"
          )
  
      image_rgb: Tensor = bgr_to_rgb(image)
      return rgb_to_grayscale(image_rgb)
  
file_path: kornia/kornia/color/gray.py
imports: from __future__ import annotations
  from typing import Optional
  import torch
  from kornia.color.rgb import bgr_to_rgb
  from kornia.core import Module, Tensor, concatenate
  from kornia.core.check import KORNIA_CHECK_IS_TENSOR
label_desc: Use image node_id 3 for calling a global function with example usage: bgr_to_grayscale(image) and returns: rgb_to_grayscale