Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions tensorboard/plugins/hparams/backend_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,9 @@ def _compute_hparam_info_from_values(self, name, values):
):
result.domain_discrete.extend(distinct_values)

if result.type == api_pb2.DATA_TYPE_BOOL:
result.domain_discrete.extend([True, False])

return result

def _experiment_from_data_provider_hparams(
Expand Down
48 changes: 44 additions & 4 deletions tensorboard/plugins/hparams/backend_context_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ def _mock_list_tensors(
},
}
result = {}
for (run, tag_to_content) in hparams_content.items():
for run, tag_to_content in hparams_content.items():
result.setdefault(run, {})
for (tag, content) in tag_to_content.items():
for tag, content in tag_to_content.items():
t = provider.TensorTimeSeries(
max_step=0,
max_wall_time=0,
Expand Down Expand Up @@ -131,9 +131,9 @@ def _mock_list_scalars(
},
}
result = {}
for (run, tag_to_content) in scalars_content.items():
for run, tag_to_content in scalars_content.items():
result.setdefault(run, {})
for (tag, content) in tag_to_content.items():
for tag, content in tag_to_content.items():
t = provider.ScalarTimeSeries(
max_step=0,
max_wall_time=0,
Expand Down Expand Up @@ -358,6 +358,46 @@ def test_experiment_without_experiment_tag_many_distinct_values(self):
_canonicalize_experiment(actual_exp)
self.assertProtoEquals(expected_exp, actual_exp)

def test_experiment_with_bool_types(self):
self.session_1_start_info_ = """
hparams:[
{key: 'batch_size' value: {bool_value: true}}
]
"""
self.session_2_start_info_ = """
hparams:[
{key: 'batch_size' value: {bool_value: true}}
]
"""
self.session_3_start_info_ = """
hparams:[
]
"""
expected_exp = """
hparam_infos: {
name: 'batch_size'
type: DATA_TYPE_BOOL
domain_discrete: {
values: [{bool_value: true}, {bool_value: false}]
}
}
metric_infos: {
name: {group: '', tag: 'accuracy'}
}
metric_infos: {
name: {group: '', tag: 'loss'}
}
metric_infos: {
name: {group: 'eval', tag: 'loss'}
}
metric_infos: {
name: {group: 'train', tag: 'loss'}
}
"""
actual_exp = self._experiment_from_metadata()
_canonicalize_experiment(actual_exp)
self.assertProtoEquals(expected_exp, actual_exp)

def test_experiment_without_any_hparams(self):
request_ctx = context.RequestContext()
actual_exp = self._experiment_from_metadata()
Expand Down