MCPcopy Index your code
hub / github.com/pytorch/pytorch / random_reader

Method random_reader

caffe2/python/dataset.py:302–326  ·  view source on GitHub ↗

Create a Reader object that is used to iterate through the dataset. NOTE: The reader order depends on the order in indices. Args: init_net: net that will be run once to create the cursor. indices: blob of reading order cursor_name: optional name

(self, init_net=None, indices=None, cursor_name=None,
                      batch_size=1, loop_over=False, enforce_batch_size=False)

Source from the content-addressed store, hash-verified

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):
304 """Create a Reader object that is used to iterate through the dataset.
305
306 NOTE: The reader order depends on the order in indices.
307
308 Args:
309 init_net: net that will be run once to create the cursor.
310 indices: blob of reading order
311 cursor_name: optional name for the blob containing a pointer
312 to the cursor.
313 batch_size: how many samples to read per iteration.
314 loop_over: repeat the dataset indefinitely (in the same order)
315
316 Returns:
317 A DatasetReader that can be used to create operators that will
318 iterate through the dataset according to indices.
319 """
320 assert self.field_blobs, 'Dataset not initialized.'
321 reader = _DatasetRandomReader(
322 self, cursor_name, indices, batch_size, loop_over,
323 enforce_batch_size)
324 if init_net is not None:
325 reader.setup_ex(init_net, None)
326 return reader
327
328 def writer(self, init_net=None):
329 """Create a Writer that can be used to append entries into the dataset.

Callers 2

test_dataset_opsMethod · 0.95
setup_exMethod · 0.80

Calls 2

setup_exMethod · 0.45

Tested by 1

test_dataset_opsMethod · 0.76