code: def generate_test_results(size, batch_size, pred, label):
      num_batch = math.ceil(size / batch_size)
      bs_residual = size % batch_size
      for i in range(num_batch):
          bs = bs_residual if i == num_batch - 1 else batch_size
          data_batch = {
              "inputs": [np.zeros((3, 10, 10)) for _ in range(bs)],
              "data_samples": [
                  BaseDataElement(label=label) for _ in range(bs)
              ],
          }
          predictions = [
              BaseDataElement(pred=pred, label=label) for _ in range(bs)
          ]
          yield (data_batch, predictions)
  
file_path: mmocr/tests/test_evaluation/test_evaluator/test_multi_datasets_evaluator.py
imports: import math
  from typing import Dict, List, Optional
  from unittest import TestCase
  import numpy
  from mmengine.evaluator import BaseMetric
  from mmengine.registry import METRICS, DefaultScope
  from mmengine.structures import BaseDataElement
  from mmocr.evaluation import MultiDatasetsEvaluator
label_desc: Use image node_id 1 for calling a global function with example usage: generate_test_results(size, batch_size, pred, label) without return types