diff --git a/tensorboard/plugins/hparams/backend_context.py b/tensorboard/plugins/hparams/backend_context.py index f3e147f529..ff248d4c5d 100644 --- a/tensorboard/plugins/hparams/backend_context.py +++ b/tensorboard/plugins/hparams/backend_context.py @@ -599,7 +599,8 @@ def _sort_and_reduce_to_hparams_limit(experiment, hparams_limit=None): None. `experiment` proto will be modified in place. """ if not hparams_limit: - hparams_limit = -1 + # If limit is unset or zero, returns all hparams. + hparams_limit = len(experiment.hparam_infos) # Prioritizes returning HParamInfo protos with `differed` values. limited_hparam_infos = sorted( diff --git a/tensorboard/plugins/hparams/backend_context_test.py b/tensorboard/plugins/hparams/backend_context_test.py index eb82bd8d24..2f36c4a6d9 100644 --- a/tensorboard/plugins/hparams/backend_context_test.py +++ b/tensorboard/plugins/hparams/backend_context_test.py @@ -1174,6 +1174,11 @@ def test_experiment_from_tags_sorts_differed_hparams_first(self): type: DATA_TYPE_FLOAT64 differs: false } + hparam_infos: { + name: 'use_batch_norm' + type: DATA_TYPE_BOOL + differs: false + } """ actual_exp = self._experiment_from_metadata( include_metrics=False, hparams_limit=None