reset - Reset minibatchqueue to start of data - MATLAB (original) (raw)

Main Content

Reset minibatchqueue to start of data

Since R2020b

Syntax

Description

reset([mbq](#mw%5F7109f0bb-1610-4396-9767-975310c37b71%5Fsep%5Fmw%5F1052debc-abad-4547-9b2c-423b954fdb8a)) resets mbq back to the start of the underlying datastore.

Examples

collapse all

Reset minibatchqueue and Obtain More Mini-Batches

You can call next on aminibatchqueue object until all data is returned. When you reach the end of the data, use reset to reset the minibatchqueue object and continue obtaining mini-batches with next.

Create a minibatchqueue object from a datastore.

ds = digitDatastore; mbq = minibatchqueue(ds,MiniBatchSize=256)

mbq = minibatchqueue with 1 output and properties:

Mini-batch creation: MiniBatchSize: 256 PartialMiniBatch: 'return' MiniBatchFcn: 'collate' PreprocessingEnvironment: 'serial'

Outputs: OutputCast: {'single'} OutputAsDlarray: 1 MiniBatchFormat: {''} OutputEnvironment: {'auto'}

Iterate over all data in the minibatchqueue object. Usehasdata to check if data is still available.

while hasdata(mbq) [~] = next(mbq); end

When hasdata returns 0 (false), you cannot collect a mini-batch usingnext.

Error using minibatchqueue/next (line 353) Unable to provide a mini-batch because end of data reached. Use reset or shuffle to continue generating mini-batches from the data set.

Reset the minibatchqueue object. Now, hasdata returns1 (true), and you can continue to obtain data using next.

Version History

Introduced in R2020b