class_docstr: Solver in Keras way.
class_docstr_tok: ["Solver","in","Keras","way","."]
docstr: Core part of training.
docstr_tok: ["Core","part","of","training","."]
code: def train_core(self, train_inputs, eval_inputs=None):
      """Core part of training."""
  
      self.build()
  
      self.session.run(tf.global_variables_initializer())
      self.session.run(tf.tables_initializer())
      self.session.run(train_inputs.iterator.initializer)
      if eval_inputs is not None:
          self.session.run(eval_inputs.iterator.initializer)
          validation_data = (
              eval_inputs.input_x_dict,
              eval_inputs.input_y_dict["input_y"],
          )
          eval_data_size = self.config["data"]["eval_data_size"]
          batch_size = self.config["data"]["task"]["batch_size"]
          validation_steps = int(eval_data_size / batch_size)
      else:
          validation_data = None
          validation_steps = None
  
      train_data_size = self.config["data"]["train_data_size"]
      num_epochs = self.config["solver"]["optimizer"]["epochs"]
      batch_size = self.config["data"]["task"]["batch_size"]
      num_batch_per_epoch = int(math.ceil(train_data_size / batch_size))
  
      callbacks = [
          tf.keras.callbacks.TensorBoard(
              os.path.join(self.model_path, "logs"),
              histogram_freq=0,
              write_graph=True,
              write_grads=True,
              write_images=True,
          ),
          tf.keras.callbacks.ModelCheckpoint(
              os.path.join(self.checkpoint_dir, "weights.{epoch:02d}"),
              save_weights_only=True,
              save_best_only=True,
          ),
      ]
  
      self.model.fit(
          train_inputs.input_x_dict,
          train_inputs.input_y_dict["input_y"],
          callbacks=callbacks,
          epochs=num_epochs,
          steps_per_epoch=num_batch_per_epoch,
          validation_data=validation_data,
          validation_steps=validation_steps,
      )
  
imports: import os
  import math
  import numpy
  import delta.compat
  from absl import logging
  from delta.utils.solver.base_solver import Solver
  from delta import utils
  from delta.utils.register import registers
  from delta.utils.solver.utils.solver_utils import get_checkpoint_dir
  from delta.utils.solver.utils.solver_utils import get_session_conf
  from delta.utils.solver.utils.solver_utils import to_saved_model
  from delta.utils.solver.utils.solver_utils import save_infer_res
label_desc: Use image node_id 7 for calling the KerasSolver obj's underlying member method code with example usage: obj.train_core(train_inputs, eval_inputs) without return types