parameters: (self)
docstring: Creates ops for reading the barrier, as used by properties like `length`.
docstring_summary: Creates ops for reading the barrier, as used by properties like `length`.
docstring_tokens: Creates ops for reading the barrier as used by properties like length .
function: def _prepare_barrier_reads(self):
      """Creates ops for reading the barrier, as used by properties like `length`.
      """
      # Ops for reading from the barrier.  These ops must be run in a
      # different thread than the prefetcher op to avoid blocking.
      received = self._barrier.take_many(
          self._batch_size, self._allow_small_batch, name="BarrierTakeMany")
  
      self._received_indices = received[0]
      self._received_keys = received[1]
      received_values = received[2]
  
      self._received_sequence = received_values[self._get_barrier_sequence_index(
      )]
      self._received_sequence_count = received_values[
          self._get_barrier_sequence_count_index()]
      self._received_next_key = received_values[self._get_barrier_next_key_index(
      )]
      self._received_length = received_values[self._get_barrier_length_index()]
      self._received_total_length = received_values[
          self._get_barrier_total_length_index()]
      self._received_context = collections.OrderedDict(
          (name, received_values[self._get_barrier_index("context", name)])
          for name in self._sorted_context.keys())
      self._received_sequences = collections.OrderedDict(
          (name, received_values[self._get_barrier_index("sequence", name)])
          for name in self._sorted_sequences.keys())
  
      self._received_batch_size = array_ops.squeeze(
          array_ops.shape(self._received_length))
  
      # Which examples are we done with?
      self._sequence_is_done = (
          self._received_sequence + 1 >= self._received_sequence_count)
  
      # Compute the number of finished sequences and dequeue as many tokens from
      # the capacity queue.
      finished_sequences = (math_ops.reduce_sum(
          math_ops.cast(self._sequence_is_done, dtypes.int32)))
      # TODO(ebrevdo): convert to dequeue_up_to when FIFOQueue supports it.
      dequeue_op = self._capacity_queue.dequeue_many(finished_sequences)
  
      # Tie the dequeue_op to the received_state, such that it is definitely
      # carried out.
      with ops.control_dependencies([dequeue_op]):
        self._received_states = collections.OrderedDict(
            (name, array_ops.identity(received_values[self._get_barrier_index(
                "state", name)])) for name in self._sorted_states.keys())
      self._next_batch = NextQueuedSequenceBatch(self)
function_tokens: def _prepare_barrier_reads ( self ) : # Ops for reading from the barrier.  These ops must be run in a # different thread than the prefetcher op to avoid blocking. received = self . _barrier . take_many ( self . _batch_size , self . _allow_small_batch , name = "BarrierTakeMany" ) self . _received_indices = received [ 0 ] self . _received_keys = received [ 1 ] received_values = received [ 2 ] self . _received_sequence = received_values [ self . _get_barrier_sequence_index ( ) ] self . _received_sequence_count = received_values [ self . _get_barrier_sequence_count_index ( ) ] self . _received_next_key = received_values [ self . _get_barrier_next_key_index ( ) ] self . _received_length = received_values [ self . _get_barrier_length_index ( ) ] self . _received_total_length = received_values [ self . _get_barrier_total_length_index ( ) ] self . _received_context = collections . OrderedDict ( ( name , received_values [ self . _get_barrier_index ( "context" , name ) ] ) for name in self . _sorted_context . keys ( ) ) self . _received_sequences = collections . OrderedDict ( ( name , received_values [ self . _get_barrier_index ( "sequence" , name ) ] ) for name in self . _sorted_sequences . keys ( ) ) self . _received_batch_size = array_ops . squeeze ( array_ops . shape ( self . _received_length ) ) # Which examples are we done with? self . _sequence_is_done = ( self . _received_sequence + 1 >= self . _received_sequence_count ) # Compute the number of finished sequences and dequeue as many tokens from # the capacity queue. finished_sequences = ( math_ops . reduce_sum ( math_ops . cast ( self . _sequence_is_done , dtypes . int32 ) ) ) # TODO(ebrevdo): convert to dequeue_up_to when FIFOQueue supports it. dequeue_op = self . _capacity_queue . dequeue_many ( finished_sequences ) # Tie the dequeue_op to the received_state, such that it is definitely # carried out. with ops . control_dependencies ( [ dequeue_op ] ) : self . _received_states = collections . OrderedDict ( ( name , array_ops . identity ( received_values [ self . _get_barrier_index ( "state" , name ) ] ) ) for name in self . _sorted_states . keys ( ) ) self . _next_batch = NextQueuedSequenceBatch ( self )