Here is the code. I tried to give this parameter 'False' value by using
python file.py --add_depth_loss False
but it still print "True".... Why is that?
from absl import flags, app
FLAGS = flags.FLAGS
flags.DEFINE_boolean('add_depth_loss', None, 'sss')
flags.mark_flag_as_required('add_depth_loss')
def main(_):
print(FLAGS.add_depth_loss)
if __name__ == '__main__':
app.run(main)
After some research, I found that the
bool
orboolean
flag is not used this way. It's actually a "set True" option. If you want to setFalse
you need to do---option=false
instead of--option False
like other types, otherwise it always returnTrue
.Even if you set
and pass
--option False
, it also returnsTrue
.Well, I'm speechless....