Returns the next record (key, value) pair produced by a reader. Will dequeue a work unit from queue if necessary (e.g. when the Reader needs to start reading from a new file since it has finished with the previous file). Args: queue: A Queue or a mutable string Tensor represe
(self, queue, name=None)
| 142 | return self._reader_ref |
| 143 | |
| 144 | def read(self, queue, name=None): |
| 145 | """Returns the next record (key, value) pair produced by a reader. |
| 146 | |
| 147 | Will dequeue a work unit from queue if necessary (e.g. when the |
| 148 | Reader needs to start reading from a new file since it has |
| 149 | finished with the previous file). |
| 150 | |
| 151 | Args: |
| 152 | queue: A Queue or a mutable string Tensor representing a handle |
| 153 | to a Queue, with string work items. |
| 154 | name: A name for the operation (optional). |
| 155 | |
| 156 | Returns: |
| 157 | A tuple of Tensors (key, value). |
| 158 | key: A string scalar Tensor. |
| 159 | value: A string scalar Tensor. |
| 160 | """ |
| 161 | if isinstance(queue, ops.Tensor): |
| 162 | queue_ref = queue |
| 163 | else: |
| 164 | queue_ref = queue.queue_ref |
| 165 | if self._reader_ref.dtype == dtypes.resource: |
| 166 | return gen_io_ops.reader_read_v2(self._reader_ref, queue_ref, name=name) |
| 167 | else: |
| 168 | # For compatibility with pre-resource queues, create a ref(string) tensor |
| 169 | # which can be looked up as the same queue by a resource manager. |
| 170 | old_queue_op = gen_data_flow_ops.fake_queue(queue_ref) |
| 171 | return gen_io_ops.reader_read(self._reader_ref, old_queue_op, name=name) |
| 172 | |
| 173 | def read_up_to(self, queue, num_records, # pylint: disable=invalid-name |
| 174 | name=None): |
no outgoing calls