class_docstr: The ``VideoClassificationData`` class is a :class:`~flash.core.data.data_module.DataModule` with a set of
  classmethods for loading data for video classification.
docstr: Load the :class:`~flash.video.classification.data.VideoClassificationData` from a dictionary containing
  PyTorch tensors representing input video frames and their corresponding targets.
  
  Input tensor(s) will be extracted from the ``input_field`` in the ``dict``.
  The targets will be extracted from the ``target_fields`` in the ``dict`` and can be in any of our
  :ref:`supported classification target formats <formatting_classification_targets>`.
  
  To learn how to customize the transforms applied for each stage, read our
  :ref:`customizing transforms guide <customizing_transforms>`.
  
  Args:
      train_data: The torch tensor or list of tensors to use when training.
      train_targets: The list of targets to use when training.
      val_data: The torch tensor or list of tensors to use when validating.
      val_targets: The list of targets to use when validating.
      test_data: The torch tensor or list of tensors to use when testing.
      test_targets: The list of targets to use when testing.
      predict_data: The torch tensor or list of tensors to use when predicting.
      train_data: A torch tensor or list of tensors to use when training.
      train_targets: The list of targets to use when training.
      target_formatter: Optionally provide a :class:`~flash.core.data.utilities.classification.TargetFormatter` to
          control how targets are handled. See :ref:`formatting_classification_targets` for more details.
      video_sampler: Sampler for the internal video container. This defines the order tensors are used and,
          if necessary, the distributed split.
      input_cls: The :class:`~flash.core.data.io.input.Input` type to use for loading the data.
      predict_input_cls: The :class:`~flash.core.data.io.input.Input` type to use for loading the prediction data.
      transform: The :class:`~flash.core.data.io.input_transform.InputTransform` type to use.
      transform_kwargs: Dict of keyword arguments to be provided when instantiating the transforms.
      data_module_kwargs: Additional keyword arguments to provide to the
          :class:`~flash.core.data.data_module.DataModule` constructor.
  
  Returns:
      The constructed :class:`~flash.video.classification.data.VideoClassificationData`.
  
  Examples
  ________
  
  .. doctest::
  
      >>> import torch
      >>> from flash import Trainer
      >>> from flash.video import VideoClassifier, VideoClassificationData
      >>> frame = torch.randint(low=0, high=255, size=(3, 5, 10, 10), dtype=torch.uint8, device="cpu")
      >>> datamodule = VideoClassificationData.from_tensors(
      ...     train_data=[frame, frame, frame],
      ...     train_targets=["fruit", "vegetable", "fruit"],
      ...     val_data=[frame, frame],
      ...     val_targets=["vegetable", "fruit"],
      ...     predict_data=[frame],
      ...     batch_size=1,
      ... )
      >>> datamodule.num_classes
      2
      >>> datamodule.labels
      ['fruit', 'vegetable']
      >>> model = VideoClassifier(backbone="x3d_xs", num_classes=datamodule.num_classes)
      >>> trainer = Trainer(fast_dev_run=True)
      >>> trainer.fit(model, datamodule=datamodule)  # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
      Training...
      >>> trainer.predict(model, datamodule=datamodule)  # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
      Predicting...
  
  .. testcleanup::
  
      >>> del frame
docstr_tok: ["Load","the",":","class",":","`","~flash.video.classification.data.VideoClassificationData","`","from","a","dictionary","containing","PyTorch","tensors","representing","input","video","frames","and","their","corresponding","targets",".","Input","tensor","(","s",")","will","be","extracted","from","the","``","input_field","``","in","the","``","dict","``",".","The","targets","will","be","extracted","from","the","``","target_fields","``","in","the","``","dict","``","and","can","be","in","any","of","our",":","ref",":","`","supported","classification","target","formats","<","formatting_classification_targets",">","`",".","To","learn","how","to","customize","the","transforms","applied","for","each","stage",",","read","our",":","ref",":","`","customizing","transforms","guide","<","customizing_transforms",">","`",".","Args",":","train_data",":","The","torch","tensor","or","list","of","tensors","to","use","when","training",".","train_targets",":","The","list","of","targets","to","use","when","training",".","val_data",":","The","torch","tensor","or","list","of","tensors","to","use","when","validating",".","val_targets",":","The","list","of","targets","to","use","when","validating",".","test_data",":","The","torch","tensor","or","list","of","tensors","to","use","when","testing",".","test_targets",":","The","list","of","targets","to","use","when","testing",".","predict_data",":","The","torch","tensor","or","list","of","tensors","to","use","when","predicting",".","train_data",":","A","torch","tensor","or","list","of","tensors","to","use","when","training",".","train_targets",":","The","list","of","targets","to","use","when","training",".","target_formatter",":","Optionally","provide","a",":","class",":","`","~flash.core.data.utilities.classification.TargetFormatter","`","to","control","how","targets","are","handled",".","See",":","ref",":","`","formatting_classification_targets","`","for","more","details",".","video_sampler",":","Sampler","for","the","internal","video","container",".","This","defines","the","order","tensors","are","used","and",",","if","necessary",",","the","distributed","split",".","input_cls",":","The",":","class",":","`","~flash.core.data.io.input.Input","`","type","to","use","for","loading","the","data",".","predict_input_cls",":","The",":","class",":","`","~flash.core.data.io.input.Input","`","type","to","use","for","loading","the","prediction","data",".","transform",":","The",":","class",":","`","~flash.core.data.io.input_transform.InputTransform","`","type","to","use",".","transform_kwargs",":","Dict","of","keyword","arguments","to","be","provided","when","instantiating","the","transforms",".","data_module_kwargs",":","Additional","keyword","arguments","to","provide","to","the",":","class",":","`","~flash.core.data.data_module.DataModule","`","constructor",".","Returns",":","The","constructed",":","class",":","`","~flash.video.classification.data.VideoClassificationData","`",".","Examples","________","..","doctest",":",":",">",">",">","import","torch",">",">",">","from","flash","import","Trainer",">",">",">","from","flash.video","import","VideoClassifier",",","VideoClassificationData",">",">",">","frame","=","torch.randint","(","low=0",",","high=255",",","size=","(","3",",","5",",","10",",","10",")",",","dtype=torch.uint8",",","device=","''","cpu","''",")",">",">",">","datamodule","=","VideoClassificationData.from_tensors","(","...","train_data=","[","frame",",","frame",",","frame","]",",","...","train_targets=","[","``","fruit","''",",","``","vegetable","''",",","``","fruit","''","]",",","...","val_data=","[","frame",",","frame","]",",","...","val_targets=","[","``","vegetable","''",",","``","fruit","''","]",",","...","predict_data=","[","frame","]",",","...","batch_size=1",",","...",")",">",">",">","datamodule.num_classes","2",">",">",">","datamodule.labels","[","'fruit","'",",","'vegetable","'","]",">",">",">","model","=","VideoClassifier","(","backbone=","''","x3d_xs","''",",","num_classes=datamodule.num_classes",")",">",">",">","trainer","=","Trainer","(","fast_dev_run=True",")",">",">",">","trainer.fit","(","model",",","datamodule=datamodule",")","#","doctest",":","+ELLIPSIS","+NORMALIZE_WHITESPACE","Training","...",">",">",">","trainer.predict","(","model",",","datamodule=datamodule",")","#","doctest",":","+ELLIPSIS","+NORMALIZE_WHITESPACE","Predicting","...","..","testcleanup",":",":",">",">",">","del","frame"]
code: def from_tensors(
      cls,
      train_data: Optional[
          Union[Collection[torch.Tensor], torch.Tensor]
      ] = None,
      train_targets: Optional[Collection[Any]] = None,
      val_data: Optional[
          Union[Collection[torch.Tensor], torch.Tensor]
      ] = None,
      val_targets: Optional[Sequence[Any]] = None,
      test_data: Optional[Collection[torch.Tensor]] = None,
      test_targets: Optional[Sequence[Any]] = None,
      predict_data: Optional[
          Union[Collection[torch.Tensor], torch.Tensor]
      ] = None,
      target_formatter: Optional[TargetFormatter] = None,
      video_sampler: Type[Sampler] = torch.utils.data.SequentialSampler,
      input_cls: Type[Input] = VideoClassificationTensorsInput,
      predict_input_cls: Type[
          Input
      ] = VideoClassificationTensorsPredictInput,
      transform: INPUT_TRANSFORM_TYPE = VideoClassificationInputTransform,
      transform_kwargs: Optional[Dict] = None,
      **data_module_kwargs: Any,
  ) -> "VideoClassificationData":
      """Load the :class:`~flash.video.classification.data.VideoClassificationData` from a dictionary containing
      PyTorch tensors representing input video frames and their corresponding targets.
  
      Input tensor(s) will be extracted from the ``input_field`` in the ``dict``.
      The targets will be extracted from the ``target_fields`` in the ``dict`` and can be in any of our
      :ref:`supported classification target formats <formatting_classification_targets>`.
  
      To learn how to customize the transforms applied for each stage, read our
      :ref:`customizing transforms guide <customizing_transforms>`.
  
      Args:
          train_data: The torch tensor or list of tensors to use when training.
          train_targets: The list of targets to use when training.
          val_data: The torch tensor or list of tensors to use when validating.
          val_targets: The list of targets to use when validating.
          test_data: The torch tensor or list of tensors to use when testing.
          test_targets: The list of targets to use when testing.
          predict_data: The torch tensor or list of tensors to use when predicting.
          train_data: A torch tensor or list of tensors to use when training.
          train_targets: The list of targets to use when training.
          target_formatter: Optionally provide a :class:`~flash.core.data.utilities.classification.TargetFormatter` to
              control how targets are handled. See :ref:`formatting_classification_targets` for more details.
          video_sampler: Sampler for the internal video container. This defines the order tensors are used and,
              if necessary, the distributed split.
          input_cls: The :class:`~flash.core.data.io.input.Input` type to use for loading the data.
          predict_input_cls: The :class:`~flash.core.data.io.input.Input` type to use for loading the prediction data.
          transform: The :class:`~flash.core.data.io.input_transform.InputTransform` type to use.
          transform_kwargs: Dict of keyword arguments to be provided when instantiating the transforms.
          data_module_kwargs: Additional keyword arguments to provide to the
              :class:`~flash.core.data.data_module.DataModule` constructor.
  
      Returns:
          The constructed :class:`~flash.video.classification.data.VideoClassificationData`.
  
      Examples
      ________
  
      .. doctest::
  
          >>> import torch
          >>> from flash import Trainer
          >>> from flash.video import VideoClassifier, VideoClassificationData
          >>> frame = torch.randint(low=0, high=255, size=(3, 5, 10, 10), dtype=torch.uint8, device="cpu")
          >>> datamodule = VideoClassificationData.from_tensors(
          ...     train_data=[frame, frame, frame],
          ...     train_targets=["fruit", "vegetable", "fruit"],
          ...     val_data=[frame, frame],
          ...     val_targets=["vegetable", "fruit"],
          ...     predict_data=[frame],
          ...     batch_size=1,
          ... )
          >>> datamodule.num_classes
          2
          >>> datamodule.labels
          ['fruit', 'vegetable']
          >>> model = VideoClassifier(backbone="x3d_xs", num_classes=datamodule.num_classes)
          >>> trainer = Trainer(fast_dev_run=True)
          >>> trainer.fit(model, datamodule=datamodule)  # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
          Training...
          >>> trainer.predict(model, datamodule=datamodule)  # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
          Predicting...
  
      .. testcleanup::
  
          >>> del frame
  
      """
  
      train_input = input_cls(
          RunningStage.TRAINING,
          train_data,
          train_targets,
          video_sampler=video_sampler,
          target_formatter=target_formatter,
      )
      target_formatter = getattr(train_input, "target_formatter", None)
  
      return cls(
          train_input,
          input_cls(
              RunningStage.VALIDATING,
              val_data,
              val_targets,
              video_sampler=video_sampler,
              target_formatter=target_formatter,
          ),
          input_cls(
              RunningStage.TESTING,
              test_data,
              test_targets,
              video_sampler=video_sampler,
              target_formatter=target_formatter,
          ),
          predict_input_cls(RunningStage.PREDICTING, predict_data),
          transform=transform,
          transform_kwargs=transform_kwargs,
          **data_module_kwargs,
      )
  
imports: from typing import Any, Callable, Collection, Dict, List, Optional, Sequence, Type, Union
  import pandas
  import torch
  from torch.utils.data import Sampler
  from flash.core.data.data_module import DataModule
  from flash.core.data.io.input import Input
  from flash.core.data.io.input_transform import INPUT_TRANSFORM_TYPE
  from flash.core.data.utilities.classification import TargetFormatter
  from flash.core.data.utilities.paths import PATH_TYPE
  from flash.core.integrations.labelstudio.input import LabelStudioVideoClassificationInput, _parse_labelstudio_arguments
  from flash.core.utilities.imports import _FIFTYONE_AVAILABLE, _PYTORCHVIDEO_AVAILABLE, _TOPIC_VIDEO_AVAILABLE, requires
  from flash.core.utilities.stages import RunningStage
  from flash.video.classification.input import VideoClassificationCSVInput, VideoClassificationCSVPredictInput, VideoClassificationDataFrameInput, VideoClassificationDataFramePredictInput, VideoClassificationFiftyOneInput, VideoClassificationFiftyOnePredictInput, VideoClassificationFilesInput, VideoClassificationFoldersInput, VideoClassificationPathsPredictInput, VideoClassificationTensorsInput, VideoClassificationTensorsPredictInput
  from flash.video.classification.input_transform import VideoClassificationInputTransform
label_desc: Use image node_id 4 for calling the VideoClassificationData obj's underlying member method code with example usage: obj.from_tensors(cls, train_data, train_targets, val_data, val_targets, test_data, test_targets, predict_data, target_formatter, video_sampler, input_cls, predict_input_cls, transform, transform_kwargs) and returns: cls