class_docstr: Generates candidates for Phoenix.
docstr: Bundles the priors and the search candidate into an ensemble.
code: def bundle_logits(
      self, priors_logits_specs, search_logits_specs, logits_dimension
  ):
      """Bundles the priors and the search candidate into an ensemble."""
  
      all_specs = priors_logits_specs + search_logits_specs
      assert all_specs, "Got no logits specs from both generators."
  
      with tf.compat.v1.variable_scope("Phoenix/Ensembler"):
          if search_logits_specs:
              assert (
                  len(search_logits_specs) == 1
              ), "Search has more than one tower."
  
          # Simplest case - no ensemble yet, just a search candidate.
          if not priors_logits_specs and search_logits_specs:
              # Returning the only set of logits we have.
              return EnsembleLogits(
                  train_logits_specs=search_logits_specs,
                  eval_logits_spec=search_logits_specs[0],
              )
  
          # Do not train already trained priors.
          stop_gradient_priors_specs = [
              spec._replace(logits=tf.stop_gradient(spec.logits))
              for spec in priors_logits_specs
          ]
          ensemble_logits = [
              spec.logits
              for spec in stop_gradient_priors_specs
              + search_logits_specs
          ]
  
          # Case 1: Average ensemble.
          # Train logits - the search generator logits if applicable.
          if (
              self._ensemble_spec.combining_type
              == ensembling_spec_pb2.EnsemblingSpec.AVERAGE_ENSEMBLE
          ):
              return self._create_average_ensemble_logits(
                  ensemble_logits, search_logits_specs
              )
  
          # Case 2: Weighted ensemble
          # Train logits should include the candidate training and the mixture
          # weights training.
          elif (
              self._ensemble_spec.combining_type
              == ensembling_spec_pb2.EnsemblingSpec.WEIGHTED_ENSEMBLE
          ):
              return self._create_weighted_ensemble_logits(
                  ensemble_logits, search_logits_specs, logits_dimension
              )
  
          else:
              raise ValueError("Invalid Ensemble combining type.")
  
file_path: model_search/model_search/ensembler.py
imports: import collections
  from model_search import logit_bundler
  from model_search.architecture import architecture_utils
  from model_search.generators import trial_utils
  from model_search.proto import ensembling_spec_pb2
  import tensorflow.compat.v2
label_desc: Use image node_id 4 for calling the Ensembler obj's underlying member method code with example usage: obj.bundle_logits(priors_logits_specs, search_logits_specs, logits_dimension) and returns: EnsembleLogits, self, self