class_docstr: A domain that takes on a fixed set of values.
  
  These values may be of any (single) domain type.
class_docstr_tok: ["A","domain","that","takes","on","a","fixed","set","of","values",".","These","values","may","be","of","any","(","single",")","domain","type","."]
docstr: Construct a discrete domain.
  
  Args:
    values: A iterable of the values in this domain.
    dtype: The Python data type of values in this domain: one of
      `int`, `float`, `bool`, or `str`. If `values` is non-empty,
      `dtype` may be `None`, in which case it will be inferred as the
      type of the first element of `values`.
  
  Raises:
    ValueError: If `values` is empty but no `dtype` is specified.
    ValueError: If `dtype` or its inferred value is not `int`,
      `float`, `bool`, or `str`.
    TypeError: If an element of `values` is not an instance of
      `dtype`.
docstr_tok: ["Construct","a","discrete","domain",".","Args",":","values",":","A","iterable","of","the","values","in","this","domain",".","dtype",":","The","Python","data","type","of","values","in","this","domain",":","one","of","`","int","`",",","`","float","`",",","`","bool","`",",","or","`","str","`",".","If","`","values","`","is","non-empty",",","`","dtype","`","may","be","`","None","`",",","in","which","case","it","will","be","inferred","as","the","type","of","the","first","element","of","`","values","`",".","Raises",":","ValueError",":","If","`","values","`","is","empty","but","no","`","dtype","`","is","specified",".","ValueError",":","If","`","dtype","`","or","its","inferred","value","is","not","`","int","`",",","`","float","`",",","`","bool","`",",","or","`","str","`",".","TypeError",":","If","an","element","of","`","values","`","is","not","an","instance","of","`","dtype","`","."]
code: def __init__(self, values, dtype=None):
      """Construct a discrete domain.
  
      Args:
        values: A iterable of the values in this domain.
        dtype: The Python data type of values in this domain: one of
          `int`, `float`, `bool`, or `str`. If `values` is non-empty,
          `dtype` may be `None`, in which case it will be inferred as the
          type of the first element of `values`.
  
      Raises:
        ValueError: If `values` is empty but no `dtype` is specified.
        ValueError: If `dtype` or its inferred value is not `int`,
          `float`, `bool`, or `str`.
        TypeError: If an element of `values` is not an instance of
          `dtype`.
      """
      self._values = list(values)
      if dtype is None:
          if self._values:
              dtype = type(self._values[0])
          else:
              raise ValueError("Empty domain with no dtype specified")
      if dtype not in (int, float, bool, str):
          raise ValueError("Unknown dtype: %r" % (dtype,))
      self._dtype = dtype
      for value in self._values:
          if not isinstance(value, self._dtype):
              raise TypeError(
                  "dtype mismatch: not isinstance(%r, %s)"
                  % (value, self._dtype.__name__)
              )
      self._values.sort()
  
imports: import abc
  import hashlib
  import json
  import random
  import time
  import numpy
  from tensorboard.compat import tf2
  from tensorboard.compat.proto import summary_pb2
  from tensorboard.plugins.hparams import api_pb2
  from tensorboard.plugins.hparams import metadata
  from tensorboard.plugins.hparams import plugin_data_pb2
label_desc: Use image node_id 1 to create a new Discrete object from inherited base classes: Domain with example: obj = Discrete(values, dtype)