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?

2
  • Is this or this what you want? Commented Sep 3, 2018 at 9: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. Commented Sep 3, 2018 at 9:25

1 Answer 1

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(',')]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.