tf.compat.v1.flags.ArgumentParser
Stay organized with collections
Save and categorize content based on your preferences.
Base class used to parse and convert arguments.
The parse() method checks to make sure that the string argument is a
legal value and convert it to a native type. If the value cannot be
converted, it should throw a 'ValueError' exception with a human
readable explanation of why the value is illegal.
Subclasses should also define a syntactic_help string which may be
presented to the user to describe the form of the legal values.
Argument parser classes must be stateless, since instances are cached
and shared between flags. Initializer arguments are allowed, but all
member variables must be derived from initializer arguments only.
Methods
flag_type
flag_type()
Returns a string representing the type of the flag.
parse
parse(
argument
)
Parses the string argument and returns the native value.
By default it returns its argument unmodified.
Args |
argument
|
string argument passed in the commandline.
|
Raises |
ValueError
|
Raised when it fails to parse the argument.
|
TypeError
|
Raised when the argument has the wrong type.
|
Returns |
The parsed value in native type.
|
Class Variables
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.ArgumentParser\n\n\u003cbr /\u003e\n\nBase class used to parse and convert arguments.\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.ArgumentParser`](/api_docs/python/tf/compat/v1/flags/ArgumentParser)\n\n\u003cbr /\u003e\n\nThe parse() method checks to make sure that the string argument is a\nlegal value and convert it to a native type. If the value cannot be\nconverted, it should throw a 'ValueError' exception with a human\nreadable explanation of why the value is illegal.\n\nSubclasses should also define a syntactic_help string which may be\npresented to the user to describe the form of the legal values.\n\nArgument parser classes must be stateless, since instances are cached\nand shared between flags. Initializer arguments are allowed, but all\nmember variables must be derived from initializer arguments only.\n\nMethods\n-------\n\n### `flag_type`\n\n flag_type()\n\nReturns a string representing the type of the flag.\n\n### `parse`\n\n parse(\n argument\n )\n\nParses the string argument and returns the native value.\n\nBy default it returns its argument unmodified.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|------------|--------------------------------------------|\n| `argument` | string argument passed in the commandline. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ||\n|--------------|----------------------------------------------|\n| `ValueError` | Raised when it fails to parse the argument. |\n| `TypeError` | Raised when the argument has the wrong type. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| The parsed value in native type. ||\n\n\u003cbr /\u003e\n\nClass Variables\n---------------\n\n- `syntactic_help = ''`"]]