class_docstr: Main class that defines training graph and defines training run method for the adding problem
docstr: Runs training
  Args:
      data_loader: iterator, Data loader for adding problem
      num_iterations: int, number of iterations to run
      log_interval: int, number of iterations after which to run validation and log
      result_dir: str, path to results directory
  
  Returns:
      float, Training loss of last iteration
code: def run(
      self,
      data_loader,
      num_iterations=1000,
      log_interval=100,
      result_dir="./",
  ):
      """
      Runs training
      Args:
          data_loader: iterator, Data loader for adding problem
          num_iterations: int, number of iterations to run
          log_interval: int, number of iterations after which to run validation and log
          result_dir: str, path to results directory
  
      Returns:
          float, Training loss of last iteration
      """
      summary_writer = tf.summary.FileWriter(
          os.path.join(result_dir, "tfboard"), tf.get_default_graph()
      )
      saver = tf.train.Saver(max_to_keep=None)
  
      sess = tf.Session(
          config=tf.ConfigProto(allow_soft_placement=True)
      )
      init = tf.group(
          tf.global_variables_initializer(),
          tf.local_variables_initializer(),
      )
      sess.run(init)
  
      for i in tqdm(range(num_iterations)):
          x_data, y_data = next(data_loader)
  
          feed_dict = {
              self.input_placeholder: x_data,
              self.label_placeholder: y_data,
              self.training_mode: True,
          }
          _, summary_train, total_loss_i = sess.run(
              [
                  self.training_update_step,
                  self.merged_summary_op_train,
                  self.training_loss,
              ],
              feed_dict=feed_dict,
          )
          summary_writer.add_summary(summary_train, i)
  
          if i % log_interval == 0:
              print("Step {}: Total: {}".format(i, total_loss_i))
              saver.save(sess, result_dir, global_step=i)
  
              feed_dict = {
                  self.input_placeholder: data_loader.test[0],
                  self.label_placeholder: data_loader.test[1],
                  self.training_mode: False,
              }
              val_loss, summary_val = sess.run(
                  [self.training_loss, self.merged_summary_op_val],
                  feed_dict=feed_dict,
              )
  
              summary_writer.add_summary(summary_val, i)
  
              print("Validation loss: {}".format(val_loss))
  
      return total_loss_i
  
file_path: nlp-architect/examples/word_language_model_with_tcn/adding_problem/adding_model.py
imports: import os
  import tensorflow
  from nlp_architect.models.temporal_convolutional_network import TCN
  from tqdm import tqdm
label_desc: Use image node_id 2 for calling the TCNForAdding obj's underlying member method code with example usage: obj.run(data_loader, num_iterations, log_interval, result_dir) and returns: total_loss_i