I couldn't find a way to embed a python code which sets flags in C++ code at https://docs.python.org/3.5/extending/embedding.html.
I have this python code test.py:
import tensorflow as tf
# Settings
flags = tf.app.flags
FLAGS = flags.FLAGS
#core params..
flags.DEFINE_string('model', 'gcn', 'model name')
flags.DEFINE_float('learning_rate', 0.01, 'initial learning rate')
flags.DEFINE_string("model_size", "small", "define model size")
def main(argv=None):
print("Flags Set")
print(FLAGS.learning_rate)
if __name__ == '__main__':
tf.app.run()
when I execute the command:
python -m test --learning_rate 0.0002
The output is:
Flags Set
0.0002
How can I embed the above python code in C++ and invoke it?