tf.compat.v1.flags.FLAGS
Stay organized with collections
Save and categorize content based on your preferences.
Registry of 'Flag' objects.
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
argv0 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.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2020-10-01 UTC."],[],[],null,["# tf.compat.v1.flags.FLAGS\n\n\u003cbr /\u003e\n\nRegistry of 'Flag' objects.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.app.flags.FLAGS`](/api_docs/python/tf/compat/v1/flags/FLAGS)\n\n\u003cbr /\u003e\n\n tf.compat.v1.flags.FLAGS(\n *args, **kwargs\n )\n\nA 'FlagValues' can then scan command line arguments, passing flag\narguments through to the 'Flag' objects that it owns. It also\nprovides easy access to the flag values. Typically only one\n'FlagValues' object is needed by an application: flags.FLAGS\n\nThis class is heavily overloaded:\n\n'Flag' objects are registered via **setitem**:\nFLAGS\\['longname'\\] = x # register a new flag\n\nThe .value attribute of the registered 'Flag' objects can be accessed\nas attributes of this 'FlagValues' object, through **getattr**. Both\nthe long and short name of the original 'Flag' objects can be used to\naccess its value:\nFLAGS.longname # parsed flag value\nFLAGS.x # parsed flag value (short name)\n\nCommand line arguments are scanned and passed to the registered 'Flag'\nobjects through the **call** method. Unparsed arguments, including\nargv[0](/versions/r2.0/api_docs/python/tf/compat/v1/flags/e.g.%20the%20program%20name) are returned.\nargv = FLAGS(sys.argv) # scan command line arguments\n\nThe original registered Flag objects can be retrieved through the use\nof the dictionary-like operator, **getitem**:\nx = FLAGS\\['longname'\\] # access the registered Flag object\n\nThe str() operator of a 'FlagValues' object provides help for all of\nthe registered 'Flag' objects."]]