class_docstr: Solver for raw tensorflow model.
class_docstr_tok: ["Solver","for","raw","tensorflow","model","."]
docstr: Build the model for training, eval and infer.
docstr_tok: ["Build","the","model","for","training",",","eval","and","infer","."]
code: def build(self, mode: str):
      """Build the model for training, eval and infer."""
      inputs = self.input_fn(mode)
  
      self.config["model"]["is_infer"] = mode == utils.INFER
  
      model = self.model_fn()
      training = mode == utils.TRAIN
      model.logits = model(inputs["input_x_dict"], training=training)
      model.iterator = inputs["iterator"]
      model.input_x_dict = inputs["input_x_dict"]
      model.input_x_len = inputs["input_x_len"]
      model.mode = mode
      loss_fn = self.get_loss_fn()
      if mode != utils.INFER or not self.infer_no_label:
          input_y = inputs["input_y_dict"]["input_y"]
          model.input_y = input_y
  
      if mode != utils.INFER:
          input_y_len = inputs["input_y_len"]
          model.loss = loss_fn(
              labels=model.input_y,
              logits=model.logits,
              input_length=model.input_x_len,
              label_length=input_y_len,
              name="loss",
          )
          model.loss_op = model.loss
          logging.info("model.loss done")
  
      # output related
      self.build_output(model)
      return model
  
file_path: delta/delta/utils/solver/raw_seq2seq_solver.py
imports: import math
  import numpy
  import delta.compat
  from absl import logging
  from delta import utils
  from delta.utils import metrics
  from delta.utils.register import registers
  from delta.utils.solver.raw_solver import RawSolver
label_desc: Use image node_id 3 for calling the RawS2SSolver obj's underlying member method code with example usage: obj.build(mode) and returns: model