code: def setup_compute(nthreads_per_trial, ngpus_per_trial):
      if nthreads_per_trial is None or nthreads_per_trial == "all":
          nthreads_per_trial = (
              ResourceManager.get_cpu_count()
          )  # Use all of processing power / trial by default. To use just half: # int(np.floor(multiprocessing.cpu_count()/2))
      if ngpus_per_trial is None:
          ngpus_per_trial = 0  # do not use GPU by default
      elif ngpus_per_trial == "all":
          ngpus_per_trial = ResourceManager.get_gpu_count()
      if (
          not isinstance(nthreads_per_trial, int)
          and nthreads_per_trial != "auto"
      ):
          raise ValueError(
              f'nthreads_per_trial must be an integer or "auto": nthreads_per_trial = {nthreads_per_trial}'
          )
      if (
          not isinstance(ngpus_per_trial, int)
          and ngpus_per_trial != "auto"
      ):
          raise ValueError(
              f'ngpus_per_trial must be an integer or "auto": ngpus_per_trial = {ngpus_per_trial}'
          )
      return nthreads_per_trial, ngpus_per_trial
  
imports: import logging
  import math
  import pickle
  import random
  import sys
  import time
  from typing import Callable, List, Tuple, Union
  import numpy
  import pandas
  import scipy.stats
  from numpy.typing import ArrayLike
  from pandas import DataFrame, Series
  from sklearn.model_selection import LeaveOneGroupOut, RepeatedKFold, RepeatedStratifiedKFold, train_test_split
  from autogluon.common.utils.resource_utils import ResourceManager
  from ..constants import BINARY, LARGE_DATA_THRESHOLD, MULTICLASS, MULTICLASS_UPPER_LIMIT, QUANTILE, REGRESS_THRESHOLD_LARGE_DATA, REGRESS_THRESHOLD_SMALL_DATA, REGRESSION, SOFTCLASS
  from ..metrics import Scorer, accuracy, pinball_loss, root_mean_squared_error
  from .miscs import warning_filter
label_desc: Use image node_id 1 for calling a global function with example usage: setup_compute(nthreads_per_trial, ngpus_per_trial) and returns: nthreads_per_trial,  ngpus_per_trial