class_docstr: Converts a list of PIL images in the range [0,255] to a torch.FloatTensor
  of shape (NUM_IMAGES x CHANNELS x HEIGHT x WIDTH) in the range [0,1].
  Can be used as first transform for ``kale.loaddata.videos.VideoFrameDataset``.
docstr: For RGB input, converts each PIL image in a list to a torch Tensor and stacks them into a single tensor.
  For flow input, converts every two PIL images (x(u)_img, y(v)_img) in a list to a torch Tensor and stacks them.
  For example, if input list size is 16, the dimension is [16, 1, 224, 224] and the frame order is
  [frame 1_x, frame 1_y, frame 2_x, frame 2_y, frame 3_x, ..., frame 8_x, frame 8_y]. The output will be
  [[frame 1_x, frame 1_y], [frame 2_x, frame 2_y], [frame 3_x, ..., [frame 8_x, frame 8_y]] and the dimension is
  [8, 2, 224, 224].
  
  Args:
      img_list: list of PIL images.
  Returns:
      tensor of size `` NUM_IMAGES x CHANNELS x HEIGHT x WIDTH``
code: def forward(self, img_list):
      """
      For RGB input, converts each PIL image in a list to a torch Tensor and stacks them into a single tensor.
      For flow input, converts every two PIL images (x(u)_img, y(v)_img) in a list to a torch Tensor and stacks them.
      For example, if input list size is 16, the dimension is [16, 1, 224, 224] and the frame order is
      [frame 1_x, frame 1_y, frame 2_x, frame 2_y, frame 3_x, ..., frame 8_x, frame 8_y]. The output will be
      [[frame 1_x, frame 1_y], [frame 2_x, frame 2_y], [frame 3_x, ..., [frame 8_x, frame 8_y]] and the dimension is
      [8, 2, 224, 224].
  
      Args:
          img_list: list of PIL images.
      Returns:
          tensor of size `` NUM_IMAGES x CHANNELS x HEIGHT x WIDTH``
      """
      if img_list[0].mode == "RGB":
          return torch.stack(
              [transforms.functional.to_tensor(pic) for pic in img_list]
          )
      elif img_list[0].mode == "L":
          it = iter(
              [transforms.functional.to_tensor(pic) for pic in img_list]
          )
          return torch.stack(
              [torch.cat((i, next(it)), dim=0) for i in it]
          )
      else:
          raise RuntimeError("Image modality is not in [rgb, flow].")
  
file_path: pykale/kale/prepdata/video_transform.py
imports: import torch
  from torchvision import transforms
label_desc: Use image node_id 1 for calling the ImglistToTensor obj's underlying member method code with example usage: obj.forward(img_list) and returns: torch, torch