MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / make_batches

Function make_batches

tensorflow/python/keras/utils/generic_utils.py:482–494  ·  view source on GitHub ↗

Returns a list of batch indices (tuples of indices). Arguments: size: Integer, total size of the data to slice into batches. batch_size: Integer, batch size. Returns: A list of tuples of array indices.

(size, batch_size)

Source from the content-addressed store, hash-verified

480
481
482def make_batches(size, batch_size):
483 """Returns a list of batch indices (tuples of indices).
484
485 Arguments:
486 size: Integer, total size of the data to slice into batches.
487 batch_size: Integer, batch size.
488
489 Returns:
490 A list of tuples of array indices.
491 """
492 num_batches = int(np.ceil(size / float(batch_size)))
493 return [(i * batch_size, min(size, (i + 1) * batch_size))
494 for i in range(0, num_batches)]
495
496
497def slice_arrays(arrays, start=None, stop=None):

Callers 2

model_iterationFunction · 0.90

Calls 2

minFunction · 0.50
rangeFunction · 0.50

Tested by

no test coverage detected