1

I want to set up a piecewise learning rate for tensor-flow Estimator object, so far I am doing like this

boundaries = [100000, 200000, 300000]
values = [0.1, 0.05, 0.01, 0.001]
global_step = tf.train.get_global_step()
learning_rate = tf.train.piecewise_constant(global_step, boundaries, values)

and then creating Estimator with these model params.

It is throwing the error ValueError: None values not supported. since value of global step is NONE.

On the other hand when I create global_step = tf.Variable(0, trainable=False), tensor of learning rate is created but it get failed later while calling an estimator object creation. Already cheked this one : How to use a decaying learning rate with an estimator in tensorflow?

iGian
  • 11,023
  • 3
  • 21
  • 36

1 Answers1

1

Use tf.train.get_or_create_global_step() instead, it will create the global step for you with its expected definition.

P-Gn
  • 23,115
  • 9
  • 87
  • 104
  • thanks for the suggestion. I tried and now it is throwing a different error while reating Estimator object. "TypeError: can't pickle _thread.RLock objects". Looking at the stack , it throws from init fucntion from estimator.py while calling deep copy . "self._params = copy.deepcopy(params or {})" – user3538035 Jun 07 '18 at 13:33