iter
Operators for manipulating the length and order of datasets.
CycleOp
Bases: DatasetOperator[Dataset, Dataset]
Operator that repeats a dataset until a given length is reached.
Source code in pipewine/operators/iter.py
IndexOp
Bases: DatasetOperator[Dataset, Dataset]
Operator that selects samples from a dataset based on their indices.
Source code in pipewine/operators/iter.py
__init__(index, negate=False)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
index
|
Sequence[int]
|
Indices of the samples to select. |
required |
negate
|
bool
|
Whether to negate the selection. Defaults to False. |
False
|
Source code in pipewine/operators/iter.py
PadOp
Bases: DatasetOperator[Dataset, Dataset]
Operator that pads a dataset to a given length by repeating a specified sample.
Source code in pipewine/operators/iter.py
__init__(length, pad_with=-1)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
length
|
int
|
Length of the resulting dataset. |
required |
pad_with
|
int
|
Index of the sample to use for padding. Defaults to -1. |
-1
|
Source code in pipewine/operators/iter.py
RepeatOp
Bases: DatasetOperator[Dataset, Dataset]
Operator that repeats a dataset a given number of times.
Source code in pipewine/operators/iter.py
__init__(times, interleave=False)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
times
|
int
|
Number of times to repeat the dataset. |
required |
interleave
|
bool
|
Whether to interleave the repeated samples. Defaults to False. |
False
|
Source code in pipewine/operators/iter.py
ReverseOp
Bases: DatasetOperator[Dataset, Dataset]
Operator that reverses the order of samples in a dataset.
Source code in pipewine/operators/iter.py
SliceOp
Bases: DatasetOperator[Dataset, Dataset]
Operator that slices a dataset based on the start, stop, and step arguments, similar to the plain Python slicing.
Source code in pipewine/operators/iter.py
__init__(start=None, stop=None, step=None)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start
|
int
|
Start index of the slice. Defaults to None. |
None
|
stop
|
int
|
Stop index of the slice. Defaults to None. |
None
|
step
|
int
|
Step of the slice. Defaults to None. |
None
|