code: def test_inference_core_api_cifar10(rank, num_slots, tmp_path):
      # Get main function from example
      example_sub_path = "torch_batch_process_core_api_comparison"
      example_path = utils.features_path(
          os.path.join(example_sub_path, "core_api_inference.py")
      )
      main_fn = utils.import_class_from_module("main", example_path)
  
      default_addr = ["0.0.0.12"]
  
      checkpoint_path = os.path.join(tmp_path, "checkpoint")
      os.mkdir(checkpoint_path)
  
      core_context = unittest.mock.MagicMock()
      # Dataset length is 10,000; num_slots is 2; batch_size is 200
      # when rank == 0, shard_length = 10,000 / 2 / 200 = 25
      # when rank == 1, shard_length = 10,000 / 2 / 200 = 25
      core_context.distributed = utils.get_mock_distributed_context(
          rank=rank, all_gather_return_value=[25, 25]
      )
      core_context.preempt.should_preempt.return_value = False
  
      with test_util.set_mock_cluster_info(
          default_addr, rank, num_slots
      ):
          main_fn(core_context)
      # Dataset length is 10,000; num_slots is 2; checkpoint_interval is 5; batch_size is 200
      # expected checkpoint count = 10000 / 2 / 5 / 200 = 5
      assert core_context.distributed.gather.call_count == 5
  
file_path: determined/harness/tests/experiment/pytorch/test_examples.py
imports: import logging
  import os
  import pathlib
  import typing
  import unittest.mock
  import pytest
  import torch
  from torch.distributed import launcher
  from determined import core
  from tests.experiment import pytorch_utils, utils
  from tests.launch import test_util
label_desc: Use image node_id 5 for calling a global function with example usage: test_inference_core_api_cifar10(rank, num_slots, tmp_path) without return types