def construct_renorm_dict(self, Rmax, Dmax, R_Iter, D_Iter):
rmax = tf.Variable(1.0, trainable=False, name='Rmax', dtype=tf.float32)
rmin = tf.Variable(0.99, trainable=False, name='Rmin', dtype=tf.float32)
dmax = tf.Variable(0.0, trainable=False, name='Dmax', dtype=tf.float32)
update_rmax = tf.cond(self.global_step<R_Iter, self.assign_add(rmax, 1, Rmax, R_Iter), self.make_noop).op
update_dmax = tf.cond(self.global_step<D_Iter, self.assign_add(dmax, 0, Dmax, D_Iter), self.make_noop).op
update_rmin = tf.cond(self.global_step<R_Iter, self.assign_inv(rmin, rmax), self.make_noop).op
tf.summary.scalar('rmax', rmax)
tf.summary.scalar('rmin', rmin)
tf.summary.scalar('dmax', dmax)
tf.add_to_collection(tf.GraphKeys.UPDATE_OPS, update_rmax)
tf.add_to_collection(tf.GraphKeys.UPDATE_OPS, update_dmax)
tf.add_to_collection(tf.GraphKeys.UPDATE_OPS, update_rmin)
self.renorm_dict = {'rmax':rmax, 'rmin':0.0, 'dmax':dmax}
评论列表
文章目录