class_docstr: Ensembler that takes the mean of logits returned by its subnetworks.
  
  Attributes:
    name: Optional name for the ensembler. Defaults to 'complexity_regularized'.
    add_mean_last_layer_predictions: Set to True to add mean of last_layer in
      subnetworks in estimator's predictions and export outputs.
class_docstr_tok: ["Ensembler","that","takes","the","mean","of","logits","returned","by","its","subnetworks",".","Attributes",":","name",":","Optional","name","for","the","ensembler",".","Defaults","to","'complexity_regularized","'",".","add_mean_last_layer_predictions",":","Set","to","True","to","add","mean","of","last_layer","in","subnetworks","in","estimator","'s","predictions","and","export","outputs","."]
code: def build_ensemble(
      self,
      subnetworks,
      previous_ensemble_subnetworks,
      features,
      labels,
      logits_dimension,
      training,
      iteration_step,
      summary,
      previous_ensemble,
      previous_iteration_checkpoint,
  ):
      del (
          features,
          labels,
          logits_dimension,
          training,
          iteration_step,
      )  # unused
      del (
          previous_ensemble_subnetworks,
          previous_iteration_checkpoint,
      )  # unused
  
      if isinstance(subnetworks[0].logits, dict):
          mean_logits = {
              key: tf.math.reduce_mean(
                  tf.stack([s.logits[key] for s in subnetworks]), axis=0
              )
              for key in subnetworks[0].logits
          }
      else:
          mean_logits = tf.math.reduce_mean(
              tf.stack([s.logits for s in subnetworks]), axis=0
          )
  
      mean_last_layer = None
      if self._add_mean_last_layer_predictions:
          mean_last_layer = {}
          if isinstance(subnetworks[0].last_layer, dict):
              for key in subnetworks[0].logits:
                  last_layers = [s.last_layer[key] for s in subnetworks]
                  self._assert_last_layer_compatible_shapes(last_layers)
                  mean_last_layer[
                      "{}_{}".format(MeanEnsemble.MEAN_LAST_LAYER, key)
                  ] = tf.math.reduce_mean(tf.stack(last_layers), axis=0)
          else:
              last_layers = [
                  subnetwork.last_layer for subnetwork in subnetworks
              ]
              self._assert_last_layer_compatible_shapes(last_layers)
              mean_last_layer = {
                  MeanEnsemble.MEAN_LAST_LAYER: tf.math.reduce_mean(
                      tf.stack(last_layers), axis=0
                  )
              }
  
      return MeanEnsemble(
          subnetworks=subnetworks,
          logits=mean_logits,
          predictions=mean_last_layer,
      )
  
file_path: adanet/adanet/ensemble/mean.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  from adanet.ensemble.ensembler import Ensemble
  from adanet.ensemble.ensembler import Ensembler
  import tensorflow.compat.v2
label_desc: Use image node_id 4 for calling the MeanEnsembler obj's underlying member method code with example usage: obj.build_ensemble(subnetworks, previous_ensemble_subnetworks, features, labels, logits_dimension, training, iteration_step, summary, previous_ensemble, previous_iteration_checkpoint) and returns: MeanEnsemble