(self)
Instantiates learning rate, decay op and train_op among others.
Instantiates learning rate, decay op and train_op among others.
Instantiates learning rate decay op and train_op among others .
def setup_optimizer(self):
    """Instantiates learning rate, decay op and train_op among others."""
    # If not training, don't need to add optimizer to the graph.
    if not self.is_training:
      self.train_op = tf.no_op()
      self.learning_rate = tf.no_op()
      return

    self.learning_rate = tf.Variable(
        self.hparams.learning_rate,
        name='learning_rate',
        trainable=False,
        dtype=tf.float32)

    # FIXME 0.5 -> hparams.decay_rate
    self.decay_op = tf.assign(self.learning_rate, 0.5 * self.learning_rate)
    self.optimizer = tf.train.AdamOptimizer(learning_rate=self.learning_rate)
    self.train_op = self.optimizer.minimize(
        self.loss, global_step=tf.train.get_global_step())
def setup_optimizer ( self ) : # If not training, don't need to add optimizer to the graph. if not self . is_training : self . train_op = tf . no_op ( ) self . learning_rate = tf . no_op ( ) return self . learning_rate = tf . Variable ( self . hparams . learning_rate , name = 'learning_rate' , trainable = False , dtype = tf . float32 ) # FIXME 0.5 -> hparams.decay_rate self . decay_op = tf . assign ( self . learning_rate , 0.5 * self . learning_rate ) self . optimizer = tf . train . AdamOptimizer ( learning_rate = self . learning_rate ) self . train_op = self . optimizer . minimize ( self . loss , global_step = tf . train . get_global_step ( ) )