class_docstr: Bundles together logits correctly for distillation.
docstr: Bundles the priors and the search candidate.
docstr_tok: ["Bundles","the","priors","and","the","search","candidate","."]
code: def bundle_logits(self, priors_logits_specs, search_logits_specs):
      """Bundles the priors and the search candidate."""
  
      assert (
          search_logits_specs
      ), "Cannot distill with no student model."
      assert (
          len(search_logits_specs) == 1
      ), "Search has more than one tower."
  
      if not priors_logits_specs:
          return DistillationLogits(
              train_logits_specs=search_logits_specs,
              eval_logits_spec=search_logits_specs[0],
              teacher_logits_spec=None,
          )
  
      with tf.compat.v1.variable_scope("Phoenix/Distiller"):
          priors_logits = tf.add_n(
              [
                  tf.stop_gradient(spec.logits)
                  for spec in priors_logits_specs
              ]
          )
  
          assert (
              self._distillation_spec.distillation_type
          ), "Invalid DistillationType specified."
          if (
              self._distillation_spec.distillation_type
              == distillation_spec_pb2.DistillationSpec.DistillationType.MSE_LOGITS
          ):
              transformed_logits = priors_logits
          else:
              transformed_logits = tf.nn.softmax(
                  priors_logits / self._distillation_spec.temperature
              )
  
          transformed_logits_specs = architecture_utils.LogitsSpec(
              logits=transformed_logits
          )
  
          # Use the logits from the student model (search) to train and evaluate,
          # but store the logits from the teacher model (combined priors) to
          # calculate the loss.
          return DistillationLogits(
              train_logits_specs=search_logits_specs,
              eval_logits_spec=search_logits_specs[0],
              teacher_logits_spec=transformed_logits_specs,
          )
  
file_path: model_search/model_search/meta/distillation.py
imports: import collections
  import functools
  from model_search import logit_bundler
  from model_search.architecture import architecture_utils
  from model_search.proto import distillation_spec_pb2
  import tensorflow.compat.v2
label_desc: Use image node_id 2 for calling the Distiller obj's underlying member method code with example usage: obj.bundle_logits(priors_logits_specs, search_logits_specs) and returns: DistillationLogits, DistillationLogits