class_docstr: An :class:`adanet.Estimator` capable of training and evaluating on TPU.
  
  Unless :code:`use_tpu=False`, training will run on TPU. However, certain parts
  of the AdaNet training loop, such as report materialization and best candidate
  selection, will still occurr on CPU. Furthermore, if using TPUEmbedding (i.e.
  :code:`embedding_config_spec` is supplied), inference will also occurr on CPU.
  
  TODO: Provide the missing functionality detailed below.
  N.B: Embeddings using the TPUEmbedding (i.e. :code:`embedding_config_spec`
  is provided) only support :code:`shared_embedding_columns` when running for
  multiple AdaNet iterations. Using regular :code:`embedding_columns` will cause
  iterations 2..n to fail because of mismatched embedding scopes.
  
  Args:
    head: See :class:`adanet.Estimator`.
    subnetwork_generator: See :class:`adanet.Estimator`.
    max_iteration_steps: See :class:`adanet.Estimator`.
    ensemblers: See :class:`adanet.Estimator`.
    ensemble_strategies: See :class:`adanet.Estimator`.
    evaluator: See :class:`adanet.Estimator`.
    report_materializer: See :class:`adanet.Estimator`.
    metric_fn: See :class:`adanet.Estimator`.
    force_grow: See :class:`adanet.Estimator`.
    replicate_ensemble_in_training: See :class:`adanet.Estimator`.
    adanet_loss_decay: See :class:`adanet.Estimator`.
    report_dir: See :class:`adanet.Estimator`.
    config: See :class:`adanet.Estimator`.
    use_tpu: Boolean to enable training on TPU. Defaults to :code:`True` and is
      only provided to allow debugging models on CPU/GPU. Use
      :class:`adanet.Estimator` instead if you do not plan to run on TPU.
    eval_on_tpu: Boolean to enable evaluating on TPU. Defaults to :code:`True`.
      Ignored if :code:`use_tpu=False`.
    export_to_tpu: See :class:`tf.compat.v1.estimator.tpu.TPUEstimator`.
    train_batch_size: See :class:`tf.compat.v1.estimator.tpu.TPUEstimator`.
      Defaults to 0 if `None`.
    eval_batch_size: See :class:`tf.compat.v1.estimator.tpu.TPUEstimator`.
      Defaults to train_batch_size if `None`.
    predict_batch_size: See :class:`tf.compat.v1.estimator.tpu.TPUEstimator`.
      Defaults to eval_batch_size if `None`.
    embedding_config_spec: See :class:`tf.compat.v1.estimator.tpu.TPUEstimator`.
      If supplied, :code:`predict` will be called on CPU and no TPU compatible
        :code:`SavedModel` will be exported.
    debug: See :class:`adanet.Estimator`.
    enable_ensemble_summaries: See :class:`adanet.Estimator`.
    enable_subnetwork_summaries: See :class:`adanet.Estimator`.
    export_subnetwork_logits: Whether to include subnetwork logits in exports.
    export_subnetwork_last_layer: Whether to include subnetwork last layer in
      exports.
    global_step_combiner_fn: See :class:`adanet.Estimator`.
    max_iterations: See :class:`adanet.Estimator`.
    replay_config: See :class:`adanet.Estimator`.
    add_predict_batch_config: If True, supplies a default
      `tpu_estimator.BatchConfig` when calling
      `tpu_estimator.model_fn_inference_on_tpu`, otherwise supplies None.
    **kwargs: Extra keyword args passed to the parent.
docstr: Construct a host_call writing scalar summaries.
  
  Args:
    current_iteration: The current `_Iteration`.
    training: Boolean indicating whether in training mode.
  
  Returns:
    (fn, args) Pair to be called by TPUEstimator as the host_call.
docstr_tok: ["Construct","a","host_call","writing","scalar","summaries",".","Args",":","current_iteration",":","The","current","`","_Iteration","`",".","training",":","Boolean","indicating","whether","in","training","mode",".","Returns",":","(","fn",",","args",")","Pair","to","be","called","by","TPUEstimator","as","the","host_call","."]
code: def _create_host_call(self, current_iteration, training):
      """Construct a host_call writing scalar summaries.
  
      Args:
        current_iteration: The current `_Iteration`.
        training: Boolean indicating whether in training mode.
  
      Returns:
        (fn, args) Pair to be called by TPUEstimator as the host_call.
      """
  
      if not training:
          return lambda **kwargs: [tf.no_op()], {}
  
      # Collect and flatten summary functions and arguments.
      summary_kwargs = collections.OrderedDict()
      gs_t = tf.reshape(
          tf.cast(tf.train.get_global_step(), dtype=tf.int32), [1]
      )
      summary_kwargs["global_step"] = gs_t
  
      summary_fns = collections.defaultdict(list)
      for i, summary in enumerate(current_iteration.summaries):
          for j, (summary_fn, tensor) in enumerate(
              summary.summary_tuples()
          ):
              summary_fns[i].append(summary_fn)
              summary_kwargs["summary_{}_{}".format(i, j)] = tensor
  
      def _host_call_fn(**kwargs):
          """Training host call.
  
          Creates summaries for training metrics.
  
          Args:
            **kwargs: Dict of {str: Tensor} , with `Tensor` of shape `[batch]`. Must
              contain key "global_step" with value of current global_step Tensor.
  
          Returns:
            List of summary ops to run on the CPU host.
          """
  
          from tensorflow.python.ops import (
              summary_ops_v2,
          )  # pylint: disable=g-direct-tensorflow-import,g-import-not-at-top
  
          gs = tf.cast(kwargs.pop("global_step")[0], dtype=tf.int64)
          for i, summary in enumerate(current_iteration.summaries):
              with summary_ops_v2.create_file_writer(
                  summary.logdir
              ).as_default():
                  with summary_ops_v2.record_summaries_every_n_global_steps(
                      n=self.config.save_summary_steps, global_step=gs
                  ):
                      for j, summary_fn in enumerate(summary_fns[i]):
                          tensor = kwargs["summary_{}_{}".format(i, j)]
                          summary_fn(tensor, step=gs)
              summary.clear_summary_tuples()
          return tf.compat.v1.summary.all_v2_summary_ops()
  
      return _host_call_fn, summary_kwargs
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import contextlib
  import functools
  from absl import logging
  from adanet import tf_compat
  from adanet.core.estimator import Estimator
  import tensorflow.compat.v2
label_desc: Use image node_id 8 for calling the TPUEstimator obj's underlying member method code with example usage: obj._create_host_call(current_iteration, training) and returns: _host_call_fn,  summary_kwargs, function,  dict, tf