# tf.compat.v1.flags.FLAGS

<br />

Registry of 'Flag' objects.

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.app.flags.FLAGS`](https://www.tensorflow.org/api_docs/python/tf/compat/v1/flags/FLAGS)

<br />

    tf.compat.v1.flags.FLAGS(
        *args, **kwargs
    )

A 'FlagValues' can then scan command line arguments, passing flag
arguments through to the 'Flag' objects that it owns. It also
provides easy access to the flag values. Typically only one
'FlagValues' object is needed by an application: flags.FLAGS

This class is heavily overloaded:

'Flag' objects are registered via **setitem**:
FLAGS\['longname'\] = x # register a new flag

The .value attribute of the registered 'Flag' objects can be accessed
as attributes of this 'FlagValues' object, through **getattr**. Both
the long and short name of the original 'Flag' objects can be used to
access its value:
FLAGS.longname # parsed flag value
FLAGS.x # parsed flag value (short name)

Command line arguments are scanned and passed to the registered 'Flag'
objects through the **call** method. Unparsed arguments, including
argv[0](https://www.tensorflow.org/versions/r2.1/api_docs/python/tf/compat/v1/flags/e.g.%20the%20program%20name) are returned.
argv = FLAGS(sys.argv) # scan command line arguments

The original registered Flag objects can be retrieved through the use
of the dictionary-like operator, **getitem**:
x = FLAGS\['longname'\] # access the registered Flag object

The str() operator of a 'FlagValues' object provides help for all of
the registered 'Flag' objects.