class_docstr: A Schema defines how to flatten a possibly hierarchical object into tuple of
  primitive objects, so it can be used as inputs/outputs of PyTorch's tracing.
  
  PyTorch does not support tracing a function that produces rich output
  structures (e.g. dict, Instances, Boxes). To trace such a function, we
  flatten the rich object into tuple of tensors, and return this tuple of tensors
  instead. Meanwhile, we also need to know how to "rebuild" the original object
  from the flattened results, so we can evaluate the flattened results.
  A Schema defines how to flatten an object, and while flattening it, it records
  necessary schemas so that the object can be rebuilt using the flattened outputs.
  
  The flattened object and the schema object is returned by ``.flatten`` classmethod.
  Then the original object can be rebuilt with the ``__call__`` method of schema.
  
  A Schema is a dataclass that can be serialized easily.
code: def _split(values, sizes):
      if len(sizes):
          expected_len = sum(sizes)
          assert (
              len(values) == expected_len
          ), f"Values has length {len(values)} but expect length {expected_len}."
      ret = []
      for k in range(len(sizes)):
          begin, end = sum(sizes[:k]), sum(sizes[: k + 1])
          ret.append(values[begin:end])
      return ret
  
imports: import collections
  from dataclasses import dataclass
  from typing import Callable, List, Optional, Tuple
  import torch
  from torch import nn
  from detectron2.structures import Boxes, Instances, ROIMasks
  from detectron2.utils.registry import _convert_target_to_string, locate
  from .torchscript_patch import patch_builtin_len
label_desc: Use image node_id 4 for calling the Schema obj's underlying member method code with example usage: obj._split(values, sizes) and returns: ret