In running python tensorflow, to pass a string or a single number, we can use tf.app.flags.DEFINE_string
or tf.app.flags.DEFINE_integer
.
But can we pass a list such as [2,3,4] or [7,8,9,6] into python tensorflow?
In running python tensorflow, to pass a string or a single number, we can use tf.app.flags.DEFINE_string
or tf.app.flags.DEFINE_integer
.
But can we pass a list such as [2,3,4] or [7,8,9,6] into python tensorflow?
Inspired by the answer https://stackoverflow.com/a/24866869/5319143
I come up with similar codes using tf.app.flags.
tf.app.flags.DEFINE_string("list_str", "3,4,5","list in string separated by comma")
the_list=[int(item) for item in FLAGS.list_str.split(',')]