<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/datasets/blob/v4.9.10/tensorflow_datasets/core/splits.py#L699-L761) |

Reading instruction for a dataset.

    tfds.core.ReadInstruction(
        split_name: str,
        from_: (int | float | None) = None,
        to: (int | float | None) = None,
        unit: str = 'abs',
        rounding: str = 'closest'
    )

See the guide: <https://www.tensorflow.org/datasets/splits>

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `split_name` | name of the split to read. Eg: 'train'. |
| `from_` | Starting position, or None if no lower boundary. |
| `to` | Ending position, or None if no upper boundary. |
| `unit` | optional, one of: '%': to set the slicing unit as percents of the split size. 'abs': to set the slicing unit as absolute numbers. 'shard': to set the slicing unit as shard. |
| `rounding` | The rounding behaviour to use when percent slicing is used. Ignored when slicing with absolute indices. Possible values: - 'closest' (default): The specified percentages are rounded to the closest value. Use this if you want specified percents to be as much exact as possible. - 'pct1_dropremainder': the specified percentages are treated as multiple of 1%. Use this option if you want consistency. Eg: len(5%) == 5 \* len(1%). Using this option, one might not be able to use the full set of examples, if the number of those is not a multiple of 100. |

<br />

## Methods

### `from_spec`

[View source](https://github.com/tensorflow/datasets/blob/v4.9.10/tensorflow_datasets/core/splits.py#L613-L642)

    @classmethod
    from_spec(
        spec: SplitArg
    ) -> AbstractSplit

Creates a ReadInstruction instance out of a string spec.

<br />

<br />

<br />

| Args ||
|---|---|
| `spec` | `str` <br /> split(s) + optional slice(s) to read. A slice can be specified, using absolute numbers (int) or percentages (int). E.g. `test`: test split. `test + validation`: test split + validation split. `test[10:]`: test split, minus its first 10 records. `test[:10%]`: first 10% records of test split. `test[:-5%]+train[40%:60%]`: first 95% of test + middle 20% of train. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| The split instance. ||

<br />

### `to_absolute`

[View source](https://github.com/tensorflow/datasets/blob/v4.9.10/tensorflow_datasets/core/splits.py#L760-L761)

    to_absolute(
        split_infos
    ) -> list[_AbsoluteInstruction]

Translate instruction into a list of absolute instructions.

Those absolute instructions are then to be added together.

<br />

<br />

<br />

| Args ||
|---|---|
| `split_infos` | [`tfds.core.SplitDict`](https://www.tensorflow.org/datasets/api_docs/python/tfds/core/SplitDict) dict associating split names to split info. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| list of _AbsoluteInstruction instances (corresponds to the + in spec). ||

<br />

### `__add__`

[View source](https://github.com/tensorflow/datasets/blob/v4.9.10/tensorflow_datasets/core/splits.py#L659-L665)

    __add__(
        other: (str | AbstractSplit)
    ) -> AbstractSplit

Sum of 2 splits.

### `__eq__`

    __eq__(
        other
    )

Return self==value.

<br />

<br />

<br />

| ## Class Variables ||
|---|---|
| from*\<a id="from*"\> | `None` |
| rounding | `'closest'` |
| to | `None` |
| unit | `'abs'` |

<br />