code: def test_divide_by_min(batch_size, n_obs, n_sub, dtype):
      """Test the helper that splits a dataset by selecting the minimum
      of a given criterion
      """
      # Generate random data, metrics and batch indices
      data_np = (
          (np.random.uniform(-1.0, 1.0, (batch_size, n_obs)))
          .astype(dtype)
          .transpose()
      )
      crit_np = (
          (np.random.uniform(-1.0, 1.0, (n_sub, batch_size)))
          .astype(dtype)
          .transpose()
      )
      b_id_np = np.array(range(batch_size), dtype=np.int32)
      data, *_ = input_to_cuml_array(data_np)
      crit, *_ = input_to_cuml_array(crit_np)
      b_id, *_ = input_to_cuml_array(b_id_np)
  
      # Call the tested function
      sub_batches, sub_id = auto_arima._divide_by_min(data, crit, b_id)
  
      # Compute the expected results in pure Python
      which_sub = crit_np.argmin(axis=1)
      sub_batches_ref = []
      sub_id_ref = []
      for i in range(n_sub):
          sub_batches_ref.append(data_np[:, which_sub == i])
          sub_id_ref.append(b_id_np[which_sub == i])
  
      # Compare the results
      for i in range(n_sub):
          # First check the cases of empty sub-batches
          if sub_batches[i] is None:
              # The reference must be empty
              assert sub_batches_ref[i].shape[1] == 0
              # And the id array must be None too
              assert sub_id[i] is None
          # When the sub-batch is not empty, compare to the reference
          else:
              np.testing.assert_allclose(
                  sub_batches[i].to_output("numpy"), sub_batches_ref[i]
              )
              np.testing.assert_array_equal(
                  sub_id[i].to_output("numpy"), sub_id_ref[i]
              )
  
file_path: cuml/python/cuml/tests/test_auto_arima.py
imports: from cuml.internals.input_utils import input_to_cuml_array
  from cuml.tsa import auto_arima
  import pytest
  from cuml.internals.safe_imports import cpu_only_import
label_desc: Use image node_id 3 for calling a global function with example usage: test_divide_by_min(batch_size, n_obs, n_sub, dtype) without return types