code: def _to_bchw(tensor: Tensor) -> Tensor:
      """Convert a PyTorch tensor image to BCHW format.
  
      Args:
          tensor (torch.Tensor): image of the form :math:`(*, H, W)`.
  
      Returns:
          input tensor of the form :math:`(B, C, H, W)`.
      """
      if not isinstance(tensor, Tensor):
          raise TypeError(
              f"Input type is not a Tensor. Got {type(tensor)}"
          )
  
      if len(tensor.shape) < 2:
          raise ValueError(
              f"Input size must be a two, three or four dimensional tensor. Got {tensor.shape}"
          )
  
      if len(tensor.shape) == 2:
          tensor = tensor.unsqueeze(0)
  
      if len(tensor.shape) == 3:
          tensor = tensor.unsqueeze(0)
  
      if len(tensor.shape) > 4:
          tensor = tensor.view(
              -1, tensor.shape[-3], tensor.shape[-2], tensor.shape[-1]
          )
  
      return tensor
  
file_path: kornia/kornia/utils/image.py
imports: from functools import wraps
  from typing import Any, Callable, List
  import torch
  from torch import nn
  from kornia.core import Tensor
label_desc: Use image node_id 3 for calling a global function with example usage: _to_bchw(tensor) and returns: tensor