code: def test_strict_require_batch_size_for_gpu():
      ray.shutdown()
      ray.init(num_cpus=4, num_gpus=1)
      ds = ray.data.range(1)
      with pytest.raises(ValueError):
          ds.map_batches(lambda x: x, num_gpus=1)
  
file_path: ray/python/ray/data/tests/test_strict_mode.py
imports: from collections import UserDict
  import numpy
  import pytest
  import ray
  from ray.data.tests.conftest import *
  from ray.tests.conftest import *
label_desc: Use image node_id 12 for calling a global function with example usage: test_strict_require_batch_size_for_gpu() without return types