//  [python]
def _set_learning_rate(self):
        self.global_step = tf.get_variable('global_step', shape=[], dtype=tf.int32,
                                           initializer=tf.constant_initializer(0),
                                           trainable=False)

        if self.args.learning_rate_strategy == 'FIXED':
            self.lr = tf.minimum(self.args.learning_rate,
                                 self.args.learning_rate / tf.log(999.) * tf.log(
                                     tf.to_float(self.global_step) + 1))
        elif self.args.learning_rate_strategy == 'HALF_COSINE_MAX':
            # from snapshot paper
            t_m = tf.constant(ceil(self.args.learning_rate_reset_epoch * self.args.num_total_samples /
                                   self.args.batch_size), dtype=tf.int32)

            self.lr = (self.args.learning_rate / 2.0) * (
                    tf.cos(tf.constant(3.1415, tf.float32) *
                           tf.to_float(tf.mod(self.global_step, t_m))
                           / tf.to_float(t_m)) + 1.0)
        elif self.args.learning_rate_strategy == 'HALF_COSINE_ZERO':
            # from snapshot paper
            t_m = tf.constant(ceil(self.args.learning_rate_reset_epoch * self.args.num_total_samples /
                                   self.args.batch_size), dtype=tf.int32)

            self.lr = (self.args.learning_rate / 2.0) * (1.0 -
                                                         tf.cos(tf.constant(3.1415, tf.float32) *
                                                                tf.to_float(tf.mod(self.global_step, t_m))
                                                                / tf.to_float(t_m)))
        elif self.args.learning_rate_strategy == 'COSINE_ZERO':
            t_m = tf.constant(ceil(self.args.learning_rate_reset_epoch * self.args.num_total_samples /
                                   self.args.batch_size), dtype=tf.int32)

            self.lr = (self.args.learning_rate / 2.0) * (1.0 -
                                                         tf.cos(tf.constant(2 * 3.1415, tf.float32) *
                                                                tf.to_float(tf.mod(self.global_step, t_m))
                                                                / tf.to_float(t_m)))
        elif self.args.learning_rate_strategy == 'COSINE_MAX':
            t_m = tf.constant(ceil(self.args.learning_rate_reset_epoch * self.args.num_total_samples /
                                   self.args.batch_size), dtype=tf.int32)

            self.lr = (self.args.learning_rate / 2.0) * (1.0 +
                                                         tf.cos(tf.constant(2 * 3.1415, tf.float32) *
                                                                tf.to_float(tf.mod(self.global_step, t_m))
                                                                / tf.to_float(t_m)))
        elif self.args.learning_rate_strategy == 'COSINE_ZERO_DECAY':
            t_m = tf.constant(ceil(self.args.learning_rate_reset_epoch * self.args.num_total_samples /
                                   self.args.batch_size), dtype=tf.int32)

            self.lr = (self.args.learning_rate /
                       tf.ceil(tf.to_float(self.global_step) / tf.to_float(t_m)) + 1) \
                      * (1.0 - tf.cos(tf.constant(2 * 3.1415, tf.float32) *
                                      tf.to_float(tf.mod(self.global_step, t_m))
                                      / tf.to_float(t_m)))
        elif self.args.learning_rate_strategy in ['CYCLE_LINEAR', 'CYCLE_SIN']:
            self.lr = tf.get_variable('lr', shape=[], dtype=tf.float32,
                                      initializer=tf.constant_initializer(self.args.learning_rate),
                                      trainable=False)
        else:
            raise NotImplementedError