class_docstr: ``SampleList`` is used to collate a list of ``Sample`` into a batch during batch
  preparation. It can be thought of as a merger of list of Dicts into a single Dict.
  
  If ``Sample`` contains an attribute 'text' of size (2) and there are 10 samples in
  list, the returned ``SampleList`` will have an attribute 'text' which is a tensor
  of size (10, 2).
  
  Args:
      samples (type): List of ``Sample`` from which the ``SampleList``
                      will be created.
  
  Usage::
  
      >>> sample_list = [
              Sample({"text": torch.tensor(2)}),
              Sample({"text": torch.tensor(2)})
          ]
      >>> sample_list.text
      torch.tensor([2, 2])
docstr: Converts a sample list to dict, this is useful for TorchScript and for
  other internal API unification efforts.
  
  Returns:
      Dict[str, Any]: A dict representation of current sample list
code: def to_dict(self) -> Dict[str, Any]:
      """Converts a sample list to dict, this is useful for TorchScript and for
      other internal API unification efforts.
  
      Returns:
          Dict[str, Any]: A dict representation of current sample list
      """
      sample_dict = {}
      fields = self.keys()
  
      for field in fields:
          # Handle nested sample list recursively
          if hasattr(self[field], "to_dict"):
              sample_dict[field] = self[field].to_dict()
          else:
              sample_dict[field] = self[field]
  
      return sample_dict
  
imports: import collections
  import collections.abc
  import warnings
  from collections import OrderedDict
  from typing import Any, Dict, Union
  import torch
label_desc: Use image node_id 21 for calling the SampleList obj's underlying member method code with example usage: obj.to_dict() and returns: sample_dict