The shuffle
function resets and shuffles the
minibatchqueue
so that you can obtain data from it in a random order.
By contrast, the reset
function resets the
minibatchqueue
to the start of the underlying datastore.
Create a minibatchqueue
from a datastore.
mbq =
minibatchqueue with 1 output and properties:
Mini-batch creation:
MiniBatchSize: 256
PartialMiniBatch: 'return'
MiniBatchFcn: 'collate'
DispatchInBackground: 0
Outputs:
OutputCast: {'single'}
OutputAsDlarray: 1
MiniBatchFormat: {''}
OutputEnvironment: {'auto'}
Obtain the first mini-batch of data.
Iterate over the rest of the data in the minibatchqueue
. Use
hasdata
to check if data is still available.
Shuffle the minibatchqueue
and obtain the first mini-batch after
the queue is shuffled.
Iterate over the remaining data again.
Reset the minibatchqueue
and obtain the first mini-batch after the
queue is reset.
Check whether the mini-batches obtained after resetting or shuffling the
minibatchqueue are the same as the first mini-batch after the
minibatchqueue
is created.
The reset
function returns the minibatchqueue
to the start of the underlying data, so that the next
function
returns mini-batches in the same order each time. By contrast, the
shuffle
function shuffles the underlying data and produces
randomized mini-batches.