Ich kann nicht scheinen global_step
von meinem gespeicherten Prüfpunkt abzurufen. Mein Code:Tensorflow kann global_step nicht vom Prüfpunkt wiederherstellen
//(...)
checkpoint_file = tf.train.latest_checkpoint(checkpoint_dir)
saver = tf.train.import_meta_graph("{}.meta".format(checkpoint_file), clear_devices=True)
saver.restore(sess, checkpoint_file)
for v in tf.global_variables():
print(v)
test = tf.get_variable("global_step")
print(test)
Ergebnis:
//(...)
Tensor("global_step/read:0", shape=(), dtype=int32)
//(...)
Traceback (most recent call last):
File "train.py", line XXX, in <module>
test = tf.get_variable("global_step")
File "(...)/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 988, in get_variable
custom_getter=custom_getter)
File "(...)/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 890, in get_variable
custom_getter=custom_getter)
File "(...)/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 348, in get_variable
validate_shape=validate_shape)
File "(...)/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 333, in _true_getter
caching_device=caching_device, validate_shape=validate_shape)
File "(...)/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 660, in _get_single_variable
"but instead was +1ms." % (name, shape))
ValueError: Shape of a new variable (global_step) must be fully defined, but instead was <unknown>.
Ich habe auch versucht global_step:0
und global_step/read:0
aber mit dem gleichen Ergebnis. Irgendwelche Tipps? Oder ich sollte tf.get_variable
nicht verwenden?
Danke