tfds.core.ReadInstruction
Stay organized with collections
Save and categorize content based on your preferences.
Reading instruction for a dataset.
tfds.core.ReadInstruction(
split_name: str,
from_: Optional[int | float] = None,
to: Optional[int | float] = None,
unit: str = 'abs',
rounding: str = 'closest'
)
See the guide: https://www.tensorflow.org/datasets/splits
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.
|
Methods
from_spec
View source
@classmethod
from_spec(
spec: SplitArg
) -> 'AbstractSplit'
Creates a ReadInstruction instance out of a string spec.
Args |
spec
|
str
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.
|
Returns |
The split instance.
|
to_absolute
View source
to_absolute(
split_infos
) -> List[_AbsoluteInstruction]
Translate instruction into a list of absolute instructions.
Those absolute instructions are then to be added together.
Returns |
list of _AbsoluteInstruction instances (corresponds to the + in spec).
|
__add__
View source
__add__(
other: Union[str, 'AbstractSplit']
) -> 'AbstractSplit'
Sum of 2 splits.
__eq__
__eq__(
other
)
Class Variables |
from<a id="from">
|
None
|
rounding
|
'closest'
|
to
|
None
|
unit
|
'abs'
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-04-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-26 UTC."],[],[]]