File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
tensorboard/plugins/hparams Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -126,12 +126,14 @@ def session_start_pb(
126
126
start_time_secs = start_time_secs ,
127
127
)
128
128
for (hp_name , hp_val ) in hparams .items ():
129
- if isinstance (hp_val , (float , int )):
129
+ # Boolean typed values need to be checked before integers since in Python
130
+ # isinstance(True/False, int) returns True.
131
+ if isinstance (hp_val , bool ):
132
+ session_start_info .hparams [hp_name ].bool_value = hp_val
133
+ elif isinstance (hp_val , (float , int )):
130
134
session_start_info .hparams [hp_name ].number_value = hp_val
131
135
elif isinstance (hp_val , str ):
132
136
session_start_info .hparams [hp_name ].string_value = hp_val
133
- elif isinstance (hp_val , bool ):
134
- session_start_info .hparams [hp_name ].bool_value = hp_val
135
137
elif isinstance (hp_val , (list , tuple )):
136
138
session_start_info .hparams [hp_name ].string_value = str (hp_val )
137
139
else :
You can’t perform that action at this time.
0 commit comments