tfm.hyperparams.override_params_dict
Stay organized with collections
Save and categorize content based on your preferences.
Override a given ParamsDict using a dict, JSON/YAML/CSV string or YAML file.
tfm.hyperparams.override_params_dict(
params, dict_or_string_or_yaml_file, is_strict
)
The logic of the function is outlined below:
- Test that the input is a dict. If not, proceed to 2.
- Tests that the input is a string. If not, raise unknown ValueError
2.1. Test if the string is in a CSV format. If so, parse.
If not, proceed to 2.2.
2.2. Try loading the string as a YAML/JSON. If successful, parse to
dict and use it to override. If not, proceed to 2.3.
2.3. Try using the string as a file path and load the YAML file.
Args |
params
|
a ParamsDict object to be overridden.
|
dict_or_string_or_yaml_file
|
a Python dict, JSON/YAML/CSV string or path to
a YAML file specifying the parameters to be overridden.
|
is_strict
|
a boolean specifying whether override is strict or not.
|
Returns |
params
|
the overridden ParamsDict object.
|
Raises |
ValueError
|
if failed to override the parameters.
|
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. Some content is licensed under the numpy license.
Last updated 2024-02-02 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 2024-02-02 UTC."],[],[]]