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
1d84aa30
Commit
1d84aa30
authored
Nov 17, 2020
by
Chen Chen
Committed by
A. Unique TensorFlower
Nov 17, 2020
Browse files
Allow to override a list/tuple in `base_config.Config` to empty list/tuple.
PiperOrigin-RevId: 342925872
parent
44cfd95e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
official/modeling/hyperparams/base_config.py
official/modeling/hyperparams/base_config.py
+2
-0
official/modeling/hyperparams/base_config_test.py
official/modeling/hyperparams/base_config_test.py
+9
-0
No files found.
official/modeling/hyperparams/base_config.py
View file @
1d84aa30
...
...
@@ -180,6 +180,8 @@ class Config(params_dict.ParamsDict):
'the list/tuple is determined by the type annotation and '
'values provided. This is error-prone.'
)
self
.
__dict__
[
k
]
=
self
.
_import_config
(
v
,
subconfig_type
)
else
:
self
.
__dict__
[
k
]
=
self
.
_import_config
(
v
,
subconfig_type
)
else
:
self
.
__dict__
[
k
]
=
self
.
_import_config
(
v
,
subconfig_type
)
...
...
official/modeling/hyperparams/base_config_test.py
View file @
1d84aa30
...
...
@@ -347,6 +347,15 @@ class BaseConfigTest(parameterized.TestCase, tf.test.TestCase):
self
.
assertIsInstance
(
config
.
y
[
1
],
DumpConfig4
)
self
.
assertSameElements
(
config
.
z
,
[
'a'
,
'b'
,
'c'
])
def
test_override_by_empty_sequence
(
self
):
config
=
DummyConfig5
()
config
.
override
({
'y'
:
[],
'z'
:
(),
},
is_strict
=
True
)
self
.
assertEmpty
(
config
.
y
)
self
.
assertEmpty
(
config
.
z
)
if
__name__
==
'__main__'
:
tf
.
test
.
main
()
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