code: def _validate_inputs(requires_grad, args, nums_frequency, spectra):
      """Checks that for each trainable argument either the number of
      frequencies or the frequency spectrum is given."""
  
      if not any(requires_grad.values()):
          raise ValueError(
              "Found no parameters to optimize. The parameters to optimize "
              "have to be marked as trainable."
          )
      for arg, (arg_name, _requires_grad) in zip(
          args, requires_grad.items()
      ):
          if _requires_grad:
              _nums_frequency = nums_frequency.get(arg_name, {})
              _spectra = spectra.get(arg_name, {})
              all_keys = set(_nums_frequency) | set(_spectra)
  
              shape = qml.math.shape(arg)
              indices = np.ndindex(shape) if len(shape) > 0 else [()]
              for par_idx in indices:
                  if par_idx not in all_keys:
                      raise ValueError(
                          "Neither the number of frequencies nor the frequency spectrum "
                          f"was provided for the entry {par_idx} of argument {arg_name}."
                      )
  
file_path: pennylane/pennylane/optimize/rotosolve.py
imports: from inspect import signature
  import numpy
  from scipy.optimize import brute, shgo
  import pennylane
label_desc: Use image node_id 3 for calling a global function with example usage: _validate_inputs(requires_grad, args, nums_frequency, spectra) without return types