如何在使用tf.Estimator

时间:2017-11-26 18:08:49

标签: tensorflow tensorflow-estimator

我使用的是TF 1.4。 我的问题是关于tf.estimator.Estimator。

我想控制"损失和步骤"的频率。信息消息,如:

INFO:tensorflow:loss = 0.00896569, step = 14901 (14.937 sec)

我将tf.estimator.RunConfig传递给Estimator的构造函数。但我不认为有一个参数来控制"损失和步骤"消息。

我认为参数在estimator.py中的_train_model方法中是硬编码的:

      worker_hooks.extend([
      training.NanTensorHook(estimator_spec.loss),
      training.LoggingTensorHook(
          {
              'loss': estimator_spec.loss,
              'step': global_step_tensor
          },
          every_n_iter=100)
  ])