2

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?

clement116
  • 317
  • 2
  • 11
  • Is [this](https://datascience.stackexchange.com/questions/15056/how-to-use-lists-in-tensorflow) or [this](https://stackoverflow.com/questions/36901287/how-to-pass-list-of-tensors-as-a-input-to-the-graph-in-tensorflow) what you want? – Sheldore Sep 03 '18 at 09:15
  • Hi Bazingaa, none of the both, I am asking to using a way to pass a list argument while we run the tensorflow program using command line. – clement116 Sep 03 '18 at 09:25

1 Answers1

1

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(',')]
clement116
  • 317
  • 2
  • 11