class_docstr: A helper object to build a device infeed queue.
  
  The InfeedQueue builds the host-side and device-side Ops to enqueue and
  dequeue elements, respectively, and ensures that their types and
  shapes match.
class_docstr_tok: ["A","helper","object","to","build","a","device","infeed","queue",".","The","InfeedQueue","builds","the","host-side","and","device-side","Ops","to","enqueue","and","dequeue","elements",",","respectively",",","and","ensures","that","their","types","and","shapes","match","."]
docstr: Sets the type of each element of the queue.
  
  tuple_types must be a list of length
  self.number_of_tuple_elements, and each element must be
  convertible to a dtype.
  
  Args:
    tuple_types: the types of each queue element.
  
  Raises:
    ValueError: if tuple_types is not of length
      self.number_of_tuple_elements.
    TypeError: if an element of tuple_types cannot be converted to a
      dtype.
code: def set_tuple_types(self, tuple_types):
      """Sets the type of each element of the queue.
  
      tuple_types must be a list of length
      self.number_of_tuple_elements, and each element must be
      convertible to a dtype.
  
      Args:
        tuple_types: the types of each queue element.
  
      Raises:
        ValueError: if tuple_types is not of length
          self.number_of_tuple_elements.
        TypeError: if an element of tuple_types cannot be converted to a
          dtype.
      """
      if len(tuple_types) != self.number_of_tuple_elements:
          raise ValueError(
              f"tuple_types is {str(tuple_types)}, but must be a list of "
              f"length {self.number_of_tuple_elements}"
          )
      if self._frozen:
          for frozen, updated in zip(self._tuple_types, tuple_types):
              if frozen != updated:
                  raise ValueError(
                      "Trying to update InfeedQueue with frozen configuration with an "
                      f"incompatible type. Frozen types are {str(self._tuple_types)}, "
                      f"updated types are {str(tuple_types)}"
                  )
      else:
          try:
              self._tuple_types = [
                  dtypes.as_dtype(t) for t in tuple_types
              ]
          except TypeError as e:
              raise TypeError(
                  f"tuple_types is {str(tuple_types)}, but must be a list of "
                  f"elements each convertible to dtype: got error {str(e)}"
              ) from e
  
imports: import itertools
  import numpy
  from tensorflow.python.compiler.xla.experimental import xla_sharding
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.ops import array_ops
  from tensorflow.python.tpu import tpu_name_util
  from tensorflow.python.tpu import tpu_sharding
  from tensorflow.python.tpu.ops import tpu_ops
  from tensorflow.python.util import nest
label_desc: Use image node_id 5 for calling the InfeedQueue obj's underlying member method code with example usage: obj.set_tuple_types(tuple_types) without return types