class_docstr: Custom Experiment class for running distributed experiments.
class_docstr_tok: ["Custom","Experiment","class","for","running","distributed","experiments","."]
docstr: Does eval and decode after training every eval_freq_in_steps.
code: def train_eval_and_decode(self):
      """Does eval and decode after training every eval_freq_in_steps."""
      eval_steps = self._hparams.eval_freq_in_steps
      packed_dataset = "_packed" in self._hparams.problem.name
      mlperf_log.transformer_print(key=mlperf_log.TRAIN_LOOP)
      for i in range(0, self._train_spec.max_steps, eval_steps):
          mlperf_log.transformer_print(
              key=mlperf_log.TRAIN_EPOCH, value=i // eval_steps
          )
          if packed_dataset and i > 0:
              problem = registry.problem(
                  self._hparams.problem.name + "_packed"
              )
              p_hparams = problem.get_hparams(self._hparams)
              self._hparams.problem = problem
              self._hparams.problem_hparams = p_hparams
          self._estimator.train(
              self._train_spec.input_fn,
              steps=eval_steps,
              hooks=self._train_spec.hooks,
          )
          self._set_eval_dir_name("eval")
          self._estimator.evaluate(
              self._eval_spec.input_fn,
              steps=self._eval_spec.steps,
              hooks=self._eval_spec.hooks,
              name="eval",
          )
          if packed_dataset:
              problem = registry.problem(
                  self._hparams.problem.name.replace("_packed", "")
              )
              p_hparams = problem.get_hparams(self._hparams)
              self._hparams.problem = problem
              self._hparams.problem_hparams = p_hparams
          mlperf_log.transformer_print(key=mlperf_log.EVAL_START)
          if self._hparams.mlperf_mode:
              self._decode_hparams.mlperf_decode_step = i + eval_steps
          self.decode(dataset_split=tf_estimator.ModeKeys.EVAL)
          d_hparams = self._decode_hparams
          if self._hparams.mlperf_mode and d_hparams.mlperf_success:
              mlperf_log.transformer_print(
                  key=mlperf_log.RUN_STOP, value={"success": "true"}
              )
              break
  
      d_hparams = self._decode_hparams
      if self._hparams.mlperf_mode and not d_hparams.mlperf_success:
          mlperf_log.transformer_print(
              key=mlperf_log.RUN_STOP, value={"success": "false"}
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import contextlib
  import json
  import os
  import random
  import numpy
  from tensor2tensor.utils import contrib
  from tensor2tensor.utils import decoding
  from tensor2tensor.utils import devices
  from tensor2tensor.utils import hparams_lib
  from tensor2tensor.utils import metrics_hook
  from tensor2tensor.utils import mlperf_log
  from tensor2tensor.utils import registry
  from tensor2tensor.utils import t2t_model
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
  from tensorflow.core.protobuf import rewriter_config_pb2
  from tensorflow.python import debug
label_desc: Use image node_id 8 for calling the T2TExperiment obj's underlying member method code with example usage: obj.train_eval_and_decode() without return types