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(
126126 start_time_secs = start_time_secs ,
127127 )
128128 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 )):
130134 session_start_info .hparams [hp_name ].number_value = hp_val
131135 elif isinstance (hp_val , str ):
132136 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
135137 elif isinstance (hp_val , (list , tuple )):
136138 session_start_info .hparams [hp_name ].string_value = str (hp_val )
137139 else :
You can’t perform that action at this time.
0 commit comments