<!-- # hard line break macro for HTML -->

# fiftyone.core.map.batcher

* [fiftyone.core.map.batcher.batch](fiftyone.core.map.batcher.batch.md)
  * [`SampleBatch`](fiftyone.core.map.batcher.batch.md#fiftyone.core.map.batcher.batch.SampleBatch)
    * [`SampleBatch.split()`](fiftyone.core.map.batcher.batch.md#fiftyone.core.map.batcher.batch.SampleBatch.split)
    * [`SampleBatch.total`](fiftyone.core.map.batcher.batch.md#fiftyone.core.map.batcher.batch.SampleBatch.total)
    * [`SampleBatch.create_subset()`](fiftyone.core.map.batcher.batch.md#fiftyone.core.map.batcher.batch.SampleBatch.create_subset)
* [fiftyone.core.map.batcher.id_batch](fiftyone.core.map.batcher.id_batch.md)
  * [`SampleIdBatch`](fiftyone.core.map.batcher.id_batch.md#fiftyone.core.map.batcher.id_batch.SampleIdBatch)
    * [`SampleIdBatch.get_max_batch_size()`](fiftyone.core.map.batcher.id_batch.md#fiftyone.core.map.batcher.id_batch.SampleIdBatch.get_max_batch_size)
    * [`SampleIdBatch.split()`](fiftyone.core.map.batcher.id_batch.md#fiftyone.core.map.batcher.id_batch.SampleIdBatch.split)
    * [`SampleIdBatch.total`](fiftyone.core.map.batcher.id_batch.md#fiftyone.core.map.batcher.id_batch.SampleIdBatch.total)
    * [`SampleIdBatch.create_subset()`](fiftyone.core.map.batcher.id_batch.md#fiftyone.core.map.batcher.id_batch.SampleIdBatch.create_subset)
* [fiftyone.core.map.batcher.slice_batch](fiftyone.core.map.batcher.slice_batch.md)
  * [`SampleSliceBatch`](fiftyone.core.map.batcher.slice_batch.md#fiftyone.core.map.batcher.slice_batch.SampleSliceBatch)
    * [`SampleSliceBatch.split()`](fiftyone.core.map.batcher.slice_batch.md#fiftyone.core.map.batcher.slice_batch.SampleSliceBatch.split)
    * [`SampleSliceBatch.total`](fiftyone.core.map.batcher.slice_batch.md#fiftyone.core.map.batcher.slice_batch.SampleSliceBatch.total)
    * [`SampleSliceBatch.create_subset()`](fiftyone.core.map.batcher.slice_batch.md#fiftyone.core.map.batcher.slice_batch.SampleSliceBatch.create_subset)

## Module contents

Sample batcher package declaration.

Copyright 2017-2026, Voxel51, Inc.
<br/>
[voxel51.com](https://voxel51.com/)
<br/>
<br/>

**Classes:**

| [`SampleBatch`](#fiftyone.core.map.batcher.SampleBatch)()                              | A sample batch            |
|----------------------------------------------------------------------------------------|---------------------------|
| [`SampleIdBatch`](#fiftyone.core.map.batcher.SampleIdBatch)(\*sample_ids)              | Sample batch using ids    |
| [`SampleSliceBatch`](#fiftyone.core.map.batcher.SampleSliceBatch)(start_idx, stop_idx) | Sample batch using slices |

### *class* fiftyone.core.map.batcher.SampleBatch

Bases: `ABC`

A sample batch

**Methods:**

| [`split`](#fiftyone.core.map.batcher.SampleBatch.split)(sample_collection, num_workers[, ...])   | Create a list of sample batches           |
|--------------------------------------------------------------------------------------------------|-------------------------------------------|
| [`create_subset`](#fiftyone.core.map.batcher.SampleBatch.create_subset)(sample_collection)       | Create a sample collection from the batch |

**Attributes:**

| [`total`](#fiftyone.core.map.batcher.SampleBatch.total)   | Get the total number of samples in the batch   |
|-----------------------------------------------------------|------------------------------------------------|

#### *abstractmethod classmethod* split(sample_collection: [SampleCollection](fiftyone.core.map.typing.md#fiftyone.core.map.typing.SampleCollection)[T], num_workers: int, batch_size: int | None = None) → List[[SampleBatch](fiftyone.core.map.batcher.batch.md#fiftyone.core.map.batcher.batch.SampleBatch)]

Create a list of sample batches

#### *abstract property* total *: int*

Get the total number of samples in the batch

#### *abstractmethod* create_subset(sample_collection: [SampleCollection](fiftyone.core.map.typing.md#fiftyone.core.map.typing.SampleCollection)[T]) → [SampleCollection](fiftyone.core.map.typing.md#fiftyone.core.map.typing.SampleCollection)[T]

Create a sample collection from the batch

### *class* fiftyone.core.map.batcher.SampleIdBatch(\*sample_ids: [ObjectId](https://pymongo.readthedocs.io/en/stable/api/bson/objectid.html#bson.objectid.ObjectId))

Bases: [`SampleBatch`](fiftyone.core.map.batcher.batch.md#fiftyone.core.map.batcher.batch.SampleBatch)

Sample batch using ids

**Methods:**

| [`get_max_batch_size`](#fiftyone.core.map.batcher.SampleIdBatch.get_max_batch_size)()            | Get max batch size                        |
|--------------------------------------------------------------------------------------------------|-------------------------------------------|
| [`split`](#fiftyone.core.map.batcher.SampleIdBatch.split)(sample_collection, num_workers[, ...]) | Create a list of sample batches           |
| [`create_subset`](#fiftyone.core.map.batcher.SampleIdBatch.create_subset)(sample_collection)     | Create a sample collection from the batch |

**Attributes:**

| [`total`](#fiftyone.core.map.batcher.SampleIdBatch.total)   | Get the total number of samples in the batch   |
|-------------------------------------------------------------|------------------------------------------------|

#### *classmethod* get_max_batch_size()

Get max batch size

#### *classmethod* split(sample_collection: [SampleCollection](fiftyone.core.map.typing.md#fiftyone.core.map.typing.SampleCollection)[T], num_workers: int, batch_size: int | None = None) → List[[SampleIdBatch](fiftyone.core.map.batcher.id_batch.md#fiftyone.core.map.batcher.id_batch.SampleIdBatch)]

Create a list of sample batches

#### *property* total *: int*

Get the total number of samples in the batch

#### create_subset(sample_collection: [SampleCollection](fiftyone.core.map.typing.md#fiftyone.core.map.typing.SampleCollection)[T]) → [SampleCollection](fiftyone.core.map.typing.md#fiftyone.core.map.typing.SampleCollection)[T]

Create a sample collection from the batch

### *class* fiftyone.core.map.batcher.SampleSliceBatch(start_idx: int, stop_idx: int)

Bases: [`SampleBatch`](fiftyone.core.map.batcher.batch.md#fiftyone.core.map.batcher.batch.SampleBatch)

Sample batch using slices

**Methods:**

| [`split`](#fiftyone.core.map.batcher.SampleSliceBatch.split)(sample_collection, num_workers[, ...])   | Create a list of sample batches           |
|-------------------------------------------------------------------------------------------------------|-------------------------------------------|
| [`create_subset`](#fiftyone.core.map.batcher.SampleSliceBatch.create_subset)(sample_collection)       | Create a sample collection from the batch |

**Attributes:**

| [`total`](#fiftyone.core.map.batcher.SampleSliceBatch.total)   | Get the total number of samples in the batch   |
|----------------------------------------------------------------|------------------------------------------------|

#### *classmethod* split(sample_collection: [SampleCollection](fiftyone.core.map.typing.md#fiftyone.core.map.typing.SampleCollection)[T], num_workers: int, batch_size: int | None = None) → List[[SampleSliceBatch](fiftyone.core.map.batcher.slice_batch.md#fiftyone.core.map.batcher.slice_batch.SampleSliceBatch)]

Create a list of sample batches

#### *property* total *: int*

Get the total number of samples in the batch

#### create_subset(sample_collection: [SampleCollection](fiftyone.core.map.typing.md#fiftyone.core.map.typing.SampleCollection)[T]) → [SampleCollection](fiftyone.core.map.typing.md#fiftyone.core.map.typing.SampleCollection)[T]

Create a sample collection from the batch
