code: def gen_extra_context(self, *args):
      # check if all_preds contains top K results or only 1 result
      pred_target_trees = []
      all_pred_trees: List[List[Tree]] = []
  
      for top_k_action_preds, action_targets, token_str_list in zip(
          self.all_preds,
          self.all_targets,
          self.all_context[DatasetFieldName.TOKENS],
      ):
          topk_pred_trees = []
          for k, action_preds in enumerate(top_k_action_preds):
              pred_tree = CompositionalMetricReporter.tree_from_tokens_and_indx_actions(
                  token_str_list,
                  self.actions_vocab,
                  action_preds,
                  validate_tree=False,
              )
              topk_pred_trees.append(
                  CompositionalMetricReporter.tree_to_metric_node(
                      pred_tree
                  )
              )
              if k == 0:
                  target_tree = CompositionalMetricReporter.tree_from_tokens_and_indx_actions(
                      token_str_list, self.actions_vocab, action_targets
                  )
                  pred_target_trees.append((pred_tree, target_tree))
          all_pred_trees.append(topk_pred_trees)
      self.pred_target_trees = pred_target_trees
      self.all_context[ALL_PRED_FRAMES] = all_pred_trees
  
imports: from typing import Dict, List, Set, Union
  from pytext.common.constants import BatchContext, DatasetFieldName, Stage
  from pytext.data import CommonMetadata
  from pytext.data.data_structures.annotation import Intent, REDUCE, SHIFT, Slot, Token, Tree, TreeBuilder
  from pytext.data.tensorizers import Tensorizer
  from pytext.data.tokenizers import Tokenizer
  from pytext.metrics.intent_slot_metrics import compute_all_metrics, FramePredictionPair, Node, Span
  from .channel import Channel, ConsoleChannel, FileChannel
  from .metric_reporter import MetricReporter
label_desc: Use image node_id 4 for calling the CompositionalMetricReporter obj's underlying member method code with example usage: obj.gen_extra_context() without return types