code: def aggregate_preds(self, new_batch, context=None):
      if new_batch is None:
          return
      tree_preds = new_batch[0]  # bsz X beam_size X seq_len
      length_preds = new_batch[1]
      target_vocab = self.tensorizers["trg_seq_tokens"].vocab
      target_pad_token = target_vocab.get_pad_index()
      target_bos_token = target_vocab.get_bos_index()
      target_eos_token = target_vocab.get_eos_index()
  
      cleaned_preds = [
          self._remove_tokens(
              pred,
              [target_pad_token, target_eos_token, target_bos_token],
          )
          for pred in self._make_simple_list(tree_preds)
      ]
      self.aggregate_data(self.all_preds, cleaned_preds)
  
      pred_trees = [
          self.stringify_annotation_tree(pred[0])
          for pred in cleaned_preds
      ]
  
      beam_pred_trees = [
          [
              CompositionalMetricReporter.tree_to_metric_node(
                  self.stringify_annotation_tree(pred)
              )
              for pred in beam
          ]
          for beam in cleaned_preds
      ]
  
      top_non_invalid_trees = [
          self.get_annotation_from_string(
              self.get_top_non_invalid(
                  [
                      self.tensorizers["trg_seq_tokens"].stringify(pred)
                      for pred in beam
                  ]
              )
          )
          for beam in cleaned_preds
      ]
  
      top_extracted_trees = [
          self.get_annotation_from_string(
              self.get_top_extract(
                  [
                      self.tensorizers["trg_seq_tokens"].stringify(pred)
                      for pred in beam
                  ]
              )
          )
          for beam in cleaned_preds
      ]
  
      self.aggregate_data(self.all_pred_trees, pred_trees)
      self.aggregate_data(self.all_target_length_preds, length_preds)
      self.aggregate_data(self.all_beam_preds, beam_pred_trees)
      self.aggregate_data(
          self.all_top_non_invalid, top_non_invalid_trees
      )
      self.aggregate_data(self.all_top_extract, top_extracted_trees)
  
imports: from collections import defaultdict
  from typing import Dict, List
  import numpy
  from pytext.common.constants import Stage
  from pytext.data.tensorizers import Tensorizer
  from pytext.metric_reporters.channel import ConsoleChannel
  from pytext.metric_reporters.compositional_metric_reporter import CompositionalMetricReporter
  from pytext.metric_reporters.seq2seq_compositional import CompositionalSeq2SeqFileChannel, Seq2SeqCompositionalMetricReporter
  from pytext.metrics.intent_slot_metrics import FramePredictionPair
  from pytext.metrics.mask_metrics import compute_masked_metrics, compute_nas_masked_metrics
  from .compositional_utils import extract_beam_subtrees, filter_invalid_beams
label_desc: Use image node_id 10 for calling the MaskedSeq2SeqCompositionalMetricReporter obj's underlying member method code with example usage: obj.aggregate_preds(new_batch, context) without return types