class_docstr: Wraps the base_plugin.TBContext to stores additional data shared across
  API handlers for the HParams plugin backend.
  
  Before adding fields to this class, carefully consider whether the
  field truly needs to be accessible to all API handlers or if it
  can be passed separately to the handler constructor. We want to
  avoid this class becoming a magic container of variables that have
  no better place. See http://wiki.c2.com/?MagicContainer
class_docstr_tok: ["Wraps","the","base_plugin.TBContext","to","stores","additional","data","shared","across","API","handlers","for","the","HParams","plugin","backend",".","Before","adding","fields","to","this","class",",","carefully","consider","whether","the","field","truly","needs","to","be","accessible","to","all","API","handlers","or","if","it","can","be","passed","separately","to","the","handler","constructor",".","We","want","to","avoid","this","class","becoming","a","magic","container","of","variables","that","have","no","better","place",".","See","http",":","\/\/wiki.c2.com\/","?","MagicContainer"]
docstr: Builds an HParamInfo message from the hparam name and list of
  values.
  
  Args:
    name: string. The hparam name.
    values: list of google.protobuf.Value messages. The list of values for the
      hparam.
  
  Returns:
    An api_pb2.HParamInfo message.
docstr_tok: ["Builds","an","HParamInfo","message","from","the","hparam","name","and","list","of","values",".","Args",":","name",":","string",".","The","hparam","name",".","values",":","list","of","google.protobuf.Value","messages",".","The","list","of","values","for","the","hparam",".","Returns",":","An","api_pb2.HParamInfo","message","."]
code: def _compute_hparam_info_from_values(self, name, values):
      """Builds an HParamInfo message from the hparam name and list of
      values.
  
      Args:
        name: string. The hparam name.
        values: list of google.protobuf.Value messages. The list of values for the
          hparam.
  
      Returns:
        An api_pb2.HParamInfo message.
      """
      # Figure out the type from the values.
      # Ignore values whose type is not listed in api_pb2.DataType
      # If all values have the same type, then that is the type used.
      # Otherwise, the returned type is DATA_TYPE_STRING.
      result = api_pb2.HParamInfo(
          name=name, type=api_pb2.DATA_TYPE_UNSET
      )
      for v in values:
          v_type = _protobuf_value_type(v)
          if not v_type:
              continue
          if result.type == api_pb2.DATA_TYPE_UNSET:
              result.type = v_type
          elif result.type != v_type:
              result.type = api_pb2.DATA_TYPE_STRING
          if result.type == api_pb2.DATA_TYPE_STRING:
              # A string result.type does not change, so we can exit the loop.
              break
  
      # If we couldn't figure out a type, then we can't compute the hparam_info.
      if result.type == api_pb2.DATA_TYPE_UNSET:
          return None
  
      if result.type == api_pb2.DATA_TYPE_STRING:
          distinct_string_values = set(
              _protobuf_value_to_string(v)
              for v in values
              if _can_be_converted_to_string(v)
          )
          result.domain_discrete.extend(distinct_string_values)
          result.differs = len(distinct_string_values) > 1
  
      if result.type == api_pb2.DATA_TYPE_BOOL:
          distinct_bool_values = set(v.bool_value for v in values)
          result.domain_discrete.extend(distinct_bool_values)
          result.differs = len(distinct_bool_values) > 1
  
      if result.type == api_pb2.DATA_TYPE_FLOAT64:
          # Always uses interval domain type for numeric hparam values.
          distinct_float_values = sorted(
              [v.number_value for v in values]
          )
          if distinct_float_values:
              result.domain_interval.min_value = distinct_float_values[
                  0
              ]
              result.domain_interval.max_value = distinct_float_values[
                  -1
              ]
              result.differs = len(set(distinct_float_values)) > 1
  
      return result
  
imports: import collections
  import os
  from tensorboard.data import provider
  from tensorboard.plugins.hparams import api_pb2
  from tensorboard.plugins.hparams import json_format_compat
  from tensorboard.plugins.hparams import metadata
  from google.protobuf import json_format
  from tensorboard.plugins.scalar import metadata
label_desc: Use image node_id 13 for calling the Context obj's underlying member method code with example usage: obj._compute_hparam_info_from_values(name, values) and returns: result, None