Skip to content

Commit a2b2088

Browse files
committed
Replace deprecated get_or_create_global_step
tf.contrib.framework.get_or_create_global_step -> tf.train.get_or_create_global_step
1 parent 4364390 commit a2b2088

File tree

7 files changed

+9
-8
lines changed

7 files changed

+9
-8
lines changed

research/adversarial_text/graphs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class VatxtModel(object):
116116
"""
117117

118118
def __init__(self, cl_logits_input_dim=None):
119-
self.global_step = tf.contrib.framework.get_or_create_global_step()
119+
self.global_step = tf.train.get_or_create_global_step()
120120
self.vocab_freqs = _get_vocab_freqs()
121121

122122
# Cache VatxtInput objects

research/learning_to_remember_rare_events/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def __init__(self, input_dim, output_dim, rep_dim, memory_size, vocab_size,
137137
self.memory = self.get_memory()
138138
self.classifier = self.get_classifier()
139139

140-
self.global_step = tf.contrib.framework.get_or_create_global_step()
140+
self.global_step = tf.train.get_or_create_global_step()
141141

142142
def get_embedder(self):
143143
return LeNet(int(self.input_dim ** 0.5), 1, self.rep_dim)

research/pcl_rl/trainer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ def init_fn(sess, saver):
364364

365365
if FLAGS.supervisor:
366366
with tf.device(tf.ReplicaDeviceSetter(FLAGS.ps_tasks, merge_devices=True)):
367-
self.global_step = tf.contrib.framework.get_or_create_global_step()
367+
self.global_step = tf.train.get_or_create_global_step()
368368
tf.set_random_seed(FLAGS.tf_seed)
369369
self.controller = self.get_controller()
370370
self.model = self.controller.model
@@ -382,7 +382,7 @@ def init_fn(sess, saver):
382382
sess = sv.PrepareSession(FLAGS.master)
383383
else:
384384
tf.set_random_seed(FLAGS.tf_seed)
385-
self.global_step = tf.contrib.framework.get_or_create_global_step()
385+
self.global_step = tf.train.get_or_create_global_step()
386386
self.controller = self.get_controller()
387387
self.model = self.controller.model
388388
self.controller.setup()

research/resnet/resnet_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def __init__(self, hps, images, labels, mode):
5656

5757
def build_graph(self):
5858
"""Build a whole graph for the model."""
59-
self.global_step = tf.contrib.framework.get_or_create_global_step()
59+
self.global_step = tf.train.get_or_create_global_step()
6060
self._build_model()
6161
if self.mode == 'train':
6262
self._build_train_op()

research/slim/nets/nasnet/nasnet_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,9 @@ def _apply_drop_path(self, net):
411411
tf.summary.scalar('layer_ratio', layer_ratio)
412412
drop_path_keep_prob = 1 - layer_ratio * (1 - drop_path_keep_prob)
413413
# Decrease the keep probability over time
414-
current_step = tf.cast(tf.contrib.framework.get_or_create_global_step(),
414+
current_step = tf.cast(tf.train.get_or_create_global_step(),
415415
tf.float32)
416+
print("HERE")
416417
drop_path_burn_in_steps = self._total_training_steps
417418
current_ratio = (
418419
current_step / drop_path_burn_in_steps)

tutorials/image/cifar10/cifar10_train.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
def train():
6262
"""Train CIFAR-10 for a number of steps."""
6363
with tf.Graph().as_default():
64-
global_step = tf.contrib.framework.get_or_create_global_step()
64+
global_step = tf.train.get_or_create_global_step()
6565

6666
# Get images and labels for CIFAR-10.
6767
# Force input pipeline to CPU:0 to avoid operations sometimes ending up on

tutorials/rnn/ptb/ptb_word_lm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def __init__(self, is_training, config, input_):
162162
optimizer = tf.train.GradientDescentOptimizer(self._lr)
163163
self._train_op = optimizer.apply_gradients(
164164
zip(grads, tvars),
165-
global_step=tf.contrib.framework.get_or_create_global_step())
165+
global_step=tf.train.get_or_create_global_step())
166166

167167
self._new_lr = tf.placeholder(
168168
tf.float32, shape=[], name="new_learning_rate")

0 commit comments

Comments
 (0)