code: def test_runner_batching(
      test_model: FrameworkTestModel,
      saved_model: bentoml.Model,
  ):
      from bentoml._internal.runner.container import AutoContainer
      from bentoml._internal.runner.utils import Params
      from bentoml._internal.runner.utils import (
          payload_paramss_to_batch_params,
      )
  
      ran_tests = False
  
      for config in test_model.configurations:
          runner = saved_model.with_options(
              **config.load_kwargs
          ).to_runner()
          runner.init_local()
          for meth, inputs in config.test_inputs.items():
              if not getattr(runner, meth).config.batchable:
                  continue
  
              if len(inputs) < 2:
                  continue
  
              ran_tests = True
  
              batch_dim = getattr(runner, meth).config.batch_dim
              paramss = [
                  Params(*inp.input_args, **inp.input_kwargs).map(
                      # pylint: disable=cell-var-from-loop # lambda used before loop continues
                      lambda arg: AutoContainer.to_payload(
                          arg, batch_dim=batch_dim[0]
                      )
                  )
                  for inp in inputs
              ]
  
              params, indices = payload_paramss_to_batch_params(
                  paramss, batch_dim[0]
              )
  
              batch_res = getattr(runner, meth).run(
                  *params.args, **params.kwargs
              )
  
              outps = AutoContainer.batch_to_payloads(
                  batch_res, indices, batch_dim[1]
              )
  
              for i, outp in enumerate(outps):
                  inputs[i].check_output(
                      AutoContainer.from_payload(outp)
                  )
  
          runner.destroy()
  
      if not ran_tests:
          pytest.skip(
              "skipping batching tests because no configuration had multiple test inputs"
          )
  
imports: from __future__ import annotations
  import logging
  import os
  import types
  import typing
  from typing import TYPE_CHECKING
  import pytest
  import bentoml
  from bentoml._internal.models.model import ModelContext
  from bentoml._internal.models.model import ModelSignature
  from bentoml._internal.runner.runner import Runner
  from bentoml._internal.runner.runner_handle.local import LocalRunnerRef
  from bentoml._internal.runner.strategy import DefaultStrategy
  from bentoml.exceptions import NotFound
  from .models import FrameworkTestModel
label_desc: Use image node_id 10 for calling a global function with example usage: test_runner_batching(test_model, saved_model) without return types