code: def _get_layer_and_inputs_from_tuner(
      mutable_id, mutable_layer_id, optional_inputs
  ):
      # optional_inputs should be name(key)s of the optional inputs
      try:
          mutable_block = trial.get_current_parameter(mutable_id)
  
          # There is a NAS tuner
          chosen_layer = mutable_block[mutable_layer_id]["chosen_layer"]
          chosen_inputs = mutable_block[mutable_layer_id][
              "chosen_inputs"
          ]
      except KeyError:
          # Try to find converted NAS parameters
          params = trial.get_current_parameter()
          expected_prefix = _construct_general_key(
              mutable_id, mutable_layer_id
          )
          chosen_layer = params[expected_prefix + "/layer_choice"]
  
          # find how many to choose
          optional_input_size = int(
              params[expected_prefix + "/optional_input_size"]
          )  # convert uniform to randint
  
          # find who to choose, can duplicate
          optional_input_state = params[
              expected_prefix + "/optional_input_chosen_state"
          ]
          chosen_inputs = []
          # make sure dict -> list produce stable result by sorting
          optional_inputs_keys = sorted(optional_inputs)
          for _ in range(optional_input_size):
              chosen_inputs.append(
                  optional_inputs_keys[
                      optional_input_state % len(optional_inputs)
                  ]
              )
              optional_input_state //= len(optional_inputs)
  
      _logger.info(
          "%s_%s: layer: %s, optional inputs: %s",
          mutable_id,
          mutable_layer_id,
          chosen_layer,
          chosen_inputs,
      )
      return chosen_layer, chosen_inputs
  
file_path: nni/nni/common/nas_utils.py
imports: import functools
  import logging
  from ..None import trial
label_desc: Use image node_id 10 for calling a global function with example usage: _get_layer_and_inputs_from_tuner(mutable_id, mutable_layer_id, optional_inputs) and returns: chosen_layer,  chosen_inputs