Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
4a351ba0
Commit
4a351ba0
authored
May 06, 2022
by
Hongkun Yu
Committed by
A. Unique TensorFlower
May 06, 2022
Browse files
Internal change
PiperOrigin-RevId: 447079920
parent
65174bdc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
official/modeling/hyperparams/params_dict.py
official/modeling/hyperparams/params_dict.py
+5
-5
No files found.
official/modeling/hyperparams/params_dict.py
View file @
4a351ba0
...
...
@@ -41,15 +41,15 @@ _PARAM_RE = re.compile(
_CONST_VALUE_RE
=
re
.
compile
(
r
'(\d.*|-\d.*|None)'
)
# Yaml
loader
with an implicit resolver to parse float decimal and exponential
# Yaml
LOADER
with an implicit resolver to parse float decimal and exponential
# format. The regular experission parse the following cases:
# 1- Decimal number with an optional exponential term.
# 2- Integer number with an exponential term.
# 3- Decimal number with an optional exponential term.
# 4- Decimal number.
LOADER
=
yaml
.
SafeLoader
LOADER
.
add_implicit_resolver
(
_
LOADER
=
yaml
.
SafeLoader
_
LOADER
.
add_implicit_resolver
(
'tag:yaml.org,2002:float'
,
re
.
compile
(
r
'''
^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+]?[0-9]+)?
...
...
@@ -332,7 +332,7 @@ class ParamsDict(object):
def
read_yaml_to_params_dict
(
file_path
:
str
):
"""Reads a YAML file to a ParamsDict."""
with
tf
.
io
.
gfile
.
GFile
(
file_path
,
'r'
)
as
f
:
params_dict
=
yaml
.
load
(
f
,
Loader
=
LOADER
)
params_dict
=
yaml
.
load
(
f
,
Loader
=
_
LOADER
)
return
ParamsDict
(
params_dict
)
...
...
@@ -453,7 +453,7 @@ def override_params_dict(params, dict_or_string_or_yaml_file, is_strict):
nested_csv_str_to_json_str
(
dict_or_string_or_yaml_file
))
except
ValueError
:
pass
params_dict
=
yaml
.
load
(
dict_or_string_or_yaml_file
,
Loader
=
LOADER
)
params_dict
=
yaml
.
load
(
dict_or_string_or_yaml_file
,
Loader
=
_
LOADER
)
if
isinstance
(
params_dict
,
dict
):
params
.
override
(
params_dict
,
is_strict
)
else
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment