---
title: "batches(ofSize:dropsLastPartialBatch:)"
framework: createmlcomponents
role: symbol
role_heading: Instance Method
path: "createmlcomponents/augmentationsequence/batches(ofsize:dropslastpartialbatch:)"
---

# batches(ofSize:dropsLastPartialBatch:)

Batches a augmentation sequence.

## Declaration

```swift
func batches(ofSize size: Int, dropsLastPartialBatch: Bool) -> AugmentationSequence<Base, RandomTransformer, RandomNumberGenerator, Annotation>.BatchedSequence
```

## Parameters

- `size`: The number of elements contained in each batch.
- `dropsLastPartialBatch`: A Boolean value representing whether the last batch should be dropped if it has less than size elements.

## Return Value

Return Value An async sequence of batches.

## See Also

### Batching an augmentation sequence

- [AugmentationSequence.BatchedSequence](createmlcomponents/augmentationsequence/batchedsequence.md)
