W3cubDocs

/TensorFlow 2.4

tf.compat.v1.flags.mark_flag_as_required

Ensures that flag is not None during program execution.

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()

Args
flag_name str, name of the flag
flag_values flags.FlagValues, optional FlagValues instance where the flag is defined.
Raises
AttributeError Raised when flag_name is not registered as a valid flag name.

© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.4/api_docs/python/tf/compat/v1/flags/mark_flag_as_required