Ensures that flag is not None during program execution.
View aliases
Compat aliases for migration
See Migration guide for more details.
`tf.compat.v1.app.flags.mark_flag_as_required`
tf.compat.v1.flags.mark_flag_as_required(
flag_name, flag_values=_flagvalues.FLAGS
)
Registers a flag validator, which will follow usual validator rules.
Important note: validator will pass for any non-None
value, such as
False
, 0
(zero), ''
(empty string) and so on.
If your module might be imported by others, and you only wish to make the flag required when the module is directly executed, call this method like this::
if __name__ == '__main__':
flags.mark_flag_as_required('your_flag_name')
app.run()