In the original code flags were set like tf.apps.flags.DEFINE_string( 'master', '', 'The address of the TensorFlow master to use.'). then i changed the tf.app.flags to tf.flags
originally FLAGS = tf.app.flags.FLAGS, changed to tf.flags.FLAGS similarly.
but the error in the tf.constant has been there in both the cases. how to fix it? i feel like this error has something to do with the python versions. but cant figure it out
replica_id=tf.constant(FLAGS.task, dtype=tf.int32, shape=()),
Try this, for me it works just fine:
import tensorflow as tf
FLAGS = tf.flags.FLAGS
tf.flags.DEFINE_integer('task', 10, "my value for the constant")
# now define your constant
replica_id = tf.constant(value=FLAGS.task, dtype=tf.float32)
# see if it works:
with tf.Session() as sess:
print(sess.run(replica_id))