我只需要打印在训练中分配的一些全局变量的值。关闭“MonitoredTrainingSession”后,我仅使用以下方法在 chief worker 中创建了一个 session :
if FLAGS.task_index == 0: with tf.Session() as sess: print sess.run(some_variable)
但是我一直收到错误:
InvalidArgumentError (see above for traceback): Cannot assign a device to node 'save/RestoreV2_20': Could not satisfy explicit device specification '/job:ps/task:0/device:CPU:0' because no devices matching that specification are registered in this process; available devices: /job:localhost/replica:0/task:0/cpu:0
知道怎么做吗?
请您参考如下方法:
available devices: /job:localhost/replica:0/task:0/cpu:0
建议您使用您创建的服务器。尝试在创建 session 时传递 server.target。
with tf.Session(server.target) as sess:
print sess.run(some_variable)
