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)
| 480 | |
| 481 | |
| 482 | def 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 | |
| 497 | def slice_arrays(arrays, start=None, stop=None): |
no test coverage detected