class_docstr: Combines flat classification examples into nested examples. When called returns nested examples
  that weren't previously returned during current iteration over examples.
  
  Args:
      is_binary: signifies whether the classifier uses binary classification head
  Attributes:
      record_example_accumulator: underling accumulator that transforms flat examples
      total_examples: overall number of flat examples that must be processed during current iteration
class_docstr_tok: ["Combines","flat","classification","examples","into","nested","examples",".","When","called","returns","nested","examples","that","were","n't","previously","returned","during","current","iteration","over","examples",".","Args",":","is_binary",":","signifies","whether","the","classifier","uses","binary","classification","head","Attributes",":","record_example_accumulator",":","underling","accumulator","that","transforms","flat","examples","total_examples",":","overall","number","of","flat","examples","that","must","be","processed","during","current","iteration"]
docstr: Postprocessor call
  
  Args:
      idx: list of string indices
      y: list of integer labels
      y_pred_probas: array of predicted probabilities
      num_examples: list of duplicated total numbers of examples
  
  Returns:
      List[RecordNestedExample]: processed but not previously returned examples (may be empty in some cases)
docstr_tok: ["Postprocessor","call","Args",":","idx",":","list","of","string","indices","y",":","list","of","integer","labels","y_pred_probas",":","array","of","predicted","probabilities","num_examples",":","list","of","duplicated","total","numbers","of","examples","Returns",":","List","[","RecordNestedExample","]",":","processed","but","not","previously","returned","examples","(","may","be","empty","in","some","cases",")"]
code: def __call__(
      self,
      idx: List[str],
      y: List[int],
      y_pred_probas: np.ndarray,
      entities: List[str],
      num_examples: List[int],
      *args,
      **kwargs,
  ) -> List[RecordNestedExample]:
      """Postprocessor call
  
      Args:
          idx: list of string indices
          y: list of integer labels
          y_pred_probas: array of predicted probabilities
          num_examples: list of duplicated total numbers of examples
  
      Returns:
          List[RecordNestedExample]: processed but not previously returned examples (may be empty in some cases)
      """
      if isinstance(y_pred_probas, list):
          y_pred_probas = [k for k in y_pred_probas if k is not None]
          y = [k for k in y if k is not None]
          y_pred_probas = np.array(y_pred_probas)
      if y == []:
          return []
      if not self.is_binary:
          # if we have outputs for both classes `0` and `1`
          y_pred_probas = y_pred_probas[:, 1]
      if self.total_examples != num_examples[0]:
          # start over if num_examples is different
          # implying that a different split is being evaluated
          self.reset_accumulator()
          self.total_examples = num_examples[0]
      for index, label, probability, entity in zip(
          idx, y, y_pred_probas, entities
      ):
          self.record_example_accumulator.add_flat_example(
              index, label, probability, entity
          )
          self.record_example_accumulator.collect_nested_example(index)
          if (
              self.record_example_accumulator.examples_processed
              >= self.total_examples
          ):
              # start over if all examples were processed
              self.reset_accumulator()
  
      return self.record_example_accumulator.return_examples()
  
imports: import math
  import random
  import re
  from collections import defaultdict
  from dataclasses import dataclass
  from logging import getLogger
  from pathlib import Path
  from typing import Tuple, List, Optional, Union, Dict, Set, Any
  import nltk
  import numpy
  import torch
  from transformers import AutoTokenizer
  from transformers.data.processors.utils import InputFeatures
  from deeppavlov.core.commands.utils import expand_path
  from deeppavlov.core.common.registry import register
  from deeppavlov.core.data.utils import zero_pad
  from deeppavlov.core.models.component import Component
  from deeppavlov.models.preprocessors.mask import Mask
label_desc: Use image node_id 2 for calling the TorchRecordPostprocessor obj's underlying member method code with example usage: obj.__call__(idx, y, y_pred_probas, entities, num_examples) and returns: self, list