code: def predict(
      self,
      data: Iterator[TypilusGraph],
      trained_network: Graph2ClassModule,
      device: Union[str, torch.device],
  ) -> Iterator[Prediction]:
      trained_network.eval()
      with torch.no_grad():
          try:
              self.__tensorize_samples_with_no_annotation = True
              self.__tensorize_keep_original_supernode_idx = True
  
              for (
                  mb_data,
                  original_datapoints,
              ) in self.minibatch_iterator(
                  self.tensorize_dataset(
                      data, return_input_data=True, parallelize=False
                  ),
                  device,
                  max_minibatch_size=50,
                  parallelize=False,
              ):
                  current_graph_idx = 0
                  graph_preds: Dict[int, Tuple[str, float]] = {}
  
                  (
                      probs,
                      predictions,
                      graph_idxs,
                  ) = trained_network.predict(mb_data["graph_mb_data"])
                  supernode_idxs = mb_data["original_supernode_idxs"]
                  for (
                      graph_idx,
                      prediction_prob,
                      prediction_id,
                      supernode_idx,
                  ) in zip(
                      graph_idxs, probs, predictions, supernode_idxs
                  ):
                      if graph_idx != current_graph_idx:
                          yield original_datapoints[
                              current_graph_idx
                          ], graph_preds
                          current_graph_idx = graph_idx
                          graph_preds: Dict[int, Tuple[str, float]] = {}
  
                      predicted_type = (
                          self.__target_vocab.get_name_for_id(
                              prediction_id
                          )
                      )
                      graph_preds[
                          supernode_idx
                      ] = predicted_type, float(prediction_prob)
                  yield original_datapoints[
                      current_graph_idx
                  ], graph_preds
          finally:
              self.__tensorize_samples_with_no_annotation = False
              self.__tensorize_keep_original_supernode_idx = False
  
imports: from typing_extensions import TypedDict
  import numpy
  import torch
  from dpu_utils.mlutils import Vocabulary
  from torch import nn
  from typing import Any, Counter, Dict, Iterator, List, NamedTuple, Optional, Tuple, Union
  from ptgnn.baseneuralmodel import AbstractNeuralModel, ModuleWithMetrics
  from ptgnn.baseneuralmodel.utils.data import enforce_not_None
  from ptgnn.neuralmodels.gnn import GnnOutput, GraphData, TensorizedGraphData
  from ptgnn.neuralmodels.gnn.graphneuralnetwork import GraphNeuralNetwork, GraphNeuralNetworkModel
label_desc: Use image node_id 12 for calling the Graph2Class obj's underlying member method code with example usage: obj.predict(data, trained_network, device) without return types