class_docstr: Class that holds an Image Tensor representation.
  
  .. note::
  
      Disclaimer: This class provides the minimum functionality for image manipulation. However, as soon
      as you start to experiment with advanced tensor manipulation, you might expect fancy
      polymorphic behaviours.
  
  .. warning::
  
      This API is experimental and might suffer changes in the future.
  
  Args:
      data: a torch tensor containing the image data.
      layout: a dataclass containing the image layout information.
  
  Examples:
      >>> # from a torch.tensor
      >>> data = torch.randint(0, 255, (3, 4, 5), dtype=torch.uint8)  # CxHxW
      >>> pixel_format = PixelFormat(
      ...     color_space=ColorSpace.RGB,
      ...     bit_depth=8,
      ... )
      >>> layout = ImageLayout(
      ...     image_size=ImageSize(4, 5),
      ...     channels=3,
      ...     channels_order=ChannelsOrder.CHANNELS_FIRST,
      ... )
      >>> img = Image(data, pixel_format, layout)
      >>> assert img.channels == 3
  
      >>> # from a numpy array (like opencv)
      >>> data = np.ones((4, 5, 3), dtype=np.uint8)  # HxWxC
      >>> img = Image.from_numpy(data, color_space=ColorSpace.RGB)
      >>> assert img.channels == 3
      >>> assert img.width == 5
      >>> assert img.height == 4
class_docstr_tok: ["Class","that","holds","an","Image","Tensor","representation",".","..","note",":",":","Disclaimer",":","This","class","provides","the","minimum","functionality","for","image","manipulation",".","However",",","as","soon","as","you","start","to","experiment","with","advanced","tensor","manipulation",",","you","might","expect","fancy","polymorphic","behaviours",".","..","warning",":",":","This","API","is","experimental","and","might","suffer","changes","in","the","future",".","Args",":","data",":","a","torch","tensor","containing","the","image","data",".","layout",":","a","dataclass","containing","the","image","layout","information",".","Examples",":",">",">",">","#","from","a","torch.tensor",">",">",">","data","=","torch.randint","(","0",",","255",",","(","3",",","4",",","5",")",",","dtype=torch.uint8",")","#","CxHxW",">",">",">","pixel_format","=","PixelFormat","(","...","color_space=ColorSpace.RGB",",","...","bit_depth=8",",","...",")",">",">",">","layout","=","ImageLayout","(","...","image_size=ImageSize","(","4",",","5",")",",","...","channels=3",",","...","channels_order=ChannelsOrder.CHANNELS_FIRST",",","...",")",">",">",">","img","=","Image","(","data",",","pixel_format",",","layout",")",">",">",">","assert","img.channels","==","3",">",">",">","#","from","a","numpy","array","(","like","opencv",")",">",">",">","data","=","np.ones","(","(","4",",","5",",","3",")",",","dtype=np.uint8",")","#","HxWxC",">",">",">","img","=","Image.from_numpy","(","data",",","color_space=ColorSpace.RGB",")",">",">",">","assert","img.channels","==","3",">",">",">","assert","img.width","==","5",">",">",">","assert","img.height","==","4"]
docstr: Return the number channels of the image.
docstr_tok: ["Return","the","number","channels","of","the","image","."]
code: def channels(self) -> int:
      """Return the number channels of the image."""
      return self.layout.channels
  
imports: from __future__ import annotations
  from pathlib import Path
  from typing import Any
  import torch
  from torch.utils.dlpack import from_dlpack, to_dlpack
  from kornia.core import Device, Dtype, Tensor
  from kornia.core.check import KORNIA_CHECK, KORNIA_CHECK_SHAPE
  from kornia.image.base import ChannelsOrder, ColorSpace, ImageLayout, ImageSize, PixelFormat
  from kornia.io.io import ImageLoadType, load_image, write_image
  from kornia.utils.image_print import image_to_string
label_desc: Use image node_id 11 for calling the Image obj's underlying member method code with example usage: obj.channels() and returns: self