def test_experiment_without_experiment_tag(self):
    self.session_1_start_info_ = "\n        hparams: [\n          {key: 'batch_size' value: {number_value: 100}},\n          {key: 'lr' value: {number_value: 0.01}},\n          {key: 'model_type' value: {string_value: 'CNN'}}\n        ]\n        "
    self.session_2_start_info_ = "\n            hparams:[\n              {key: 'batch_size' value: {number_value: 200}},\n              {key: 'lr' value: {number_value: 0.02}},\n              {key: 'model_type' value: {string_value: 'LATTICE'}}\n            ]\n        "
    self.session_3_start_info_ = "\n            hparams:[\n              {key: 'batch_size' value: {number_value: 300}},\n              {key: 'lr' value: {number_value: 0.05}},\n              {key: 'model_type' value: {string_value: 'CNN'}}\n            ]\n        "
    expected_exp = "\n            hparam_infos: {\n              name: 'batch_size'\n              type: DATA_TYPE_FLOAT64\n            },\n            hparam_infos: {\n              name: 'lr'\n              type: DATA_TYPE_FLOAT64\n            },\n            hparam_infos: {\n              name: 'model_type'\n              type: DATA_TYPE_STRING\n              domain_discrete: {\n                values: [{string_value: 'CNN'},\n                         {string_value: 'LATTICE'}]\n              }\n            }\n            metric_infos: {\n              name: {group: '', tag: 'accuracy'}\n            }\n            metric_infos: {\n              name: {group: '', tag: 'loss'}\n            }\n            metric_infos: {\n              name: {group: 'eval', tag: 'loss'}\n            }\n            metric_infos: {\n              name: {group: 'train', tag: 'loss'}\n            }\n        "
    ctxt = backend_context.Context(self._mock_tb_context)
    request_ctx = context.RequestContext()
    actual_exp = ctxt.experiment_from_metadata(request_ctx, '123', ctxt.hparams_metadata(request_ctx, '123'))
    _canonicalize_experiment(actual_exp)
    self.assertProtoEquals(expected_exp, actual_exp)
def test_experiment_without_experiment_tag(self):
    self.session_1_start_info_ = "\n        hparams: [\n          {key: 'batch_size' value: {number_value: 100}},\n          {key: 'lr' value: {number_value: 0.01}},\n          {key: 'model_type' value: {string_value: 'CNN'}}\n        ]\n        "
    self.session_2_start_info_ = "\n            hparams:[\n              {key: 'batch_size' value: {number_value: 200}},\n              {key: 'lr' value: {number_value: 0.02}},\n              {key: 'model_type' value: {string_value: 'LATTICE'}}\n            ]\n        "
    self.session_3_start_info_ = "\n            hparams:[\n              {key: 'batch_size' value: {number_value: 300}},\n              {key: 'lr' value: {number_value: 0.05}},\n              {key: 'model_type' value: {string_value: 'CNN'}}\n            ]\n        "
    expected_exp = "\n            hparam_infos: {\n              name: 'batch_size'\n              type: DATA_TYPE_FLOAT64\n            },\n            hparam_infos: {\n              name: 'lr'\n              type: DATA_TYPE_FLOAT64\n            },\n            hparam_infos: {\n              name: 'model_type'\n              type: DATA_TYPE_STRING\n              domain_discrete: {\n                values: [{string_value: 'CNN'},\n                         {string_value: 'LATTICE'}]\n              }\n            }\n            metric_infos: {\n              name: {group: , tag: 'accuracy'}\n            }\n            metric_infos: {\n              name: {group: , tag: 'loss'}\n            }\n            metric_infos: {\n              name: {group: 'eval', tag: 'loss'}\n            }\n            metric_infos: {\n              name: {group: 'train', tag: 'loss'}\n            }\n        "
    ctxt = backend_context.Context(self._mock_tb_context)
    request_ctx = context.RequestContext()
    actual_exp = ctxt.experiment_from_metadata(request_ctx, '123', ctxt.hparams_metadata(request_ctx, '123'))
    _canonicalize_experiment(actual_exp)
    self.assertProtoEquals(expected_exp, actual_exp)