class_docstr: Base context class that contains runtime information for any Determined
  workflow that uses the ``tf.keras`` API.
class_docstr_tok: ["Base","context","class","that","contains","runtime","information","for","any","Determined","workflow","that","uses","the","``","tf.keras","``","API","."]
code: def __init__(self, *arg: Any, **kwarg: Any):
      super().__init__(*arg, **kwarg)
  
      self.dataset_initialized = False
  
      (
          self._per_slot_batch_size,
          self._global_batch_size,
      ) = util.calculate_batch_sizes(
          self.get_hparams(),
          self.env.experiment_config.slots_per_trial(),
          "TFKerasTrial",
      )
  
      self.experimental = TFKerasExperimentalContext()
  
      # The following three attributes are initialized during the lifetime of a
      # TFKerasTrialContext instance by the user calling compile() and
      # fit_generator() / fit(), respectively.
      self.model = None  # type: Optional[tf.keras.Model]
      self.compile_args = None  # type: Optional[inspect.BoundArguments]
      self.train_config = None  # type: Optional[TFKerasTrainConfig]
  
      optimizations_config = (
          self.env.experiment_config.get_optimizations_config()
      )
      self._aggregation_frequency = cast(
          int, optimizations_config.get("aggregation_frequency")
      )
      self._average_aggregated_gradients = cast(
          bool, optimizations_config.get("average_aggregated_gradients")
      )
  
      self._optimizers = []  # type: List[tf.keras.optimizers.Optimizer]
      self._wrapped_optimizers = (
          []
      )  # type: List[tf.keras.optimizers.Optimizer]
      self._compiled_optimizer = (
          None
      )  # type: Optional[tf.keras.optimizers.Optimizer]
  
      # The following attributes may be configured via configure_fit().  Defaults match the
      # normal keras.fit() defaults.
      self._fit_verbose = True
      self._fit_class_weight = None
      self._fit_workers = 1
      self._fit_use_multiprocessing = False
      self._fit_max_queue_size = 10
      self._fit_shuffle = True
      self._fit_validation_steps = None
  
imports: import inspect
  import logging
  from typing import Any, Callable, Dict, List, NamedTuple, Optional, Union, cast
  import tensorflow
  import determined
  from determined import errors, keras, util
  from determined.common import check
  from determined.horovod import hvd
label_desc: Use image node_id 1 to create a new TFKerasTrialContext object from inherited base classes: det with example: obj = TFKerasTrialContext()