code: def split_non_tensors(
      mixed: Union[torch.Tensor, Tuple[Any, ...]]
  ) -> Tuple[Tuple[torch.Tensor, ...], Optional[Dict[str, List[Any]]]]:
      """
      Split a tuple into a list of tensors and the rest with information
      for later reconstruction.
  
      When called with a tensor X, will return: (x,), None
  
      Usage::
  
          x = torch.Tensor([1])
          y = torch.Tensor([2])
          tensors, packed_non_tensors = split_non_tensors((x, y, None, 3))
          assert tensors == (x, y)
          assert packed_non_tensors == {
              "is_tensor": [True, True, False, False],
              "objects": [None, 3],
          }
          recon = unpack_non_tensors(tensors, packed_non_tensors)
          assert recon == (x, y, None, 3)
      """
      if isinstance(mixed, torch.Tensor):
          return (mixed,), None
      tensors: List[torch.Tensor] = []
      packed_non_tensors: Dict[str, List[Any]] = {
          "is_tensor": [],
          "objects": [],
      }
      for o in mixed:
          if isinstance(o, torch.Tensor):
              packed_non_tensors["is_tensor"].append(True)
              tensors.append(o)
          else:
              packed_non_tensors["is_tensor"].append(False)
              packed_non_tensors["objects"].append(o)
      return tuple(tensors), packed_non_tensors
  
file_path: fairscale/fairscale/internal/containers.py
imports: from collections import OrderedDict
  from typing import Any, Callable, Dict, List, NamedTuple, Optional, Set, Tuple, Union, cast
  import numpy
  import torch
  from torch.nn.utils.rnn import PackedSequence
label_desc: Use image node_id 7 for calling a global function with example usage: split_non_tensors(mixed) and returns: tuple,  packed_non_tensors, mixed,  None