Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access all flags and get their values using loop in Tensorflow?

I want to write all flags and its values in external file(like txt). How can I get automatically all the contents inside tf.flag? is there any built-in function? or is there easy way e.g. by using loop?

for example,

tf.flags.DEFINE_string("device","/gpu:0", "select device")
tf.flags.DEFINE_integer("rnn_size","64", "number of units")

I want to get

device /gpu:0 
rnn_size 64
like image 659
user270700 Avatar asked Oct 27 '16 13:10

user270700


2 Answers

For tensorflow 1.5 you can use tf.app.flags.FLAGS.flag_values_dict() they have changed the flags library one more time

like image 59
alyaxey Avatar answered Nov 04 '22 08:11

alyaxey


Looking at the source, it appears the API doesn't support it directly. If you need a hack, you can use tf.flags.FLAGS.__flags to get the dictionary.

like image 36
Mark McDonald Avatar answered Nov 04 '22 07:11

Mark McDonald