code: def compute_budgets(
      min_resources: float,
      max_resources: float,
      reduction_factor: int,
      num_rungs: int,
      num_brackets: int,
  ):
      """Compute the budgets used for ASHA"""
  
      # Tracks state for new trial add
      if num_brackets > num_rungs:
          logger.warning(
              "The input num_brackets %i is larger than the number of rungs %i, "
              "set num_brackets as %i",
              num_brackets,
              num_rungs,
              num_rungs,
          )
          num_brackets = num_rungs
  
      budgets = np.logspace(
          np.log(min_resources) / np.log(reduction_factor),
          np.log(max_resources) / np.log(reduction_factor),
          num_rungs,
          base=reduction_factor,
      )
      budgets = (budgets + 0.5).astype(int)
  
      for i in range(num_rungs - 1):
          if budgets[i] >= budgets[i + 1]:
              budgets[i + 1] = budgets[i] + 1
  
      if budgets[-1] > max_resources:
          raise ValueError(
              BUDGET_ERROR.format(
                  min_resources, max_resources, num_rungs
              )
          )
  
      resources = [
          budgets[bracket_index:]
          for bracket_index in range(num_brackets)
      ]
      budgets_lists: list[list[BudgetTuple]] = []
      budgets_tab: dict[int, list[BudgetTuple]] = defaultdict(list)
      for bracket_ressources in resources:
          bracket_budgets: list[BudgetTuple] = []
          for i, min_ressources in enumerate(bracket_ressources[::-1]):
              budget = BudgetTuple(
                  reduction_factor**i, min_ressources
              )
              bracket_budgets.append(budget)
              budgets_tab[len(bracket_ressources) - i - 1].append(
                  budget
              )
          budgets_lists.append(bracket_budgets[::-1])
  
      display_budgets(budgets_tab, max_resources, reduction_factor)
  
      return list(budgets_lists)
  
imports: from __future__ import annotations
  import copy
  import logging
  from collections import defaultdict
  from typing import Sequence
  import numpy
  from orion.algo.hyperband import BudgetTuple, Hyperband, HyperbandBracket, display_budgets
  from orion.algo.space import Space
  from orion.core.utils.flatten import flatten
  from orion.core.worker.trial import Trial
label_desc: Use image node_id 1 for calling a global function with example usage: compute_budgets(min_resources, max_resources, reduction_factor, num_rungs, num_brackets) and returns: list