Create a Reader object that is used to iterate through the dataset. This will append operations to `init_net` that create a TreeCursor, used to iterate through the data. NOTE: Currently, it is not safe to append to a dataset while reading. Args: init_ne
(self, init_net=None, cursor_name=None, batch_size=1,
enforce_batch_size=False)
| 274 | return self.field_types |
| 275 | |
| 276 | def reader(self, init_net=None, cursor_name=None, batch_size=1, |
| 277 | enforce_batch_size=False): |
| 278 | """Create a Reader object that is used to iterate through the dataset. |
| 279 | |
| 280 | This will append operations to `init_net` that create a TreeCursor, |
| 281 | used to iterate through the data. |
| 282 | |
| 283 | NOTE: Currently, it is not safe to append to a dataset while reading. |
| 284 | |
| 285 | Args: |
| 286 | init_net: net that will be run once to create the cursor. |
| 287 | cursor_name: optional name for the blob containing a pointer |
| 288 | to the cursor. |
| 289 | batch_size: how many samples to read per iteration. |
| 290 | |
| 291 | Returns: |
| 292 | A _DatasetReader that can be used to create operators that will |
| 293 | iterate through the dataset. |
| 294 | """ |
| 295 | assert self.field_blobs, 'Dataset not initialized.' |
| 296 | reader = _DatasetReader(self, cursor_name, batch_size, |
| 297 | enforce_batch_size) |
| 298 | if init_net is not None: |
| 299 | reader.setup_ex(init_net, None) |
| 300 | return reader |
| 301 | |
| 302 | def random_reader(self, init_net=None, indices=None, cursor_name=None, |
| 303 | batch_size=1, loop_over=False, enforce_batch_size=False): |