eachobs
function
defined in module
MLUtils
eachobs(data; kws...)
Return an iterator over
data
.
Supports the same arguments as
DataLoader
. The
batchsize
default is
-1
here while it is
1
for
DataLoader
.
X
=
rand
(
4
,
100
)
for
x
in
eachobs
(
X
)
# loop entered 100 times
@
assert
typeof
(
x
)
<:
Vector
{
Float64
}
@
assert
size
(
x
)
==
(
4
,
)
end
# mini-batch iterations
for
x
in
eachobs
(
X
,
batchsize
=
10
)
# loop entered 10 times
@
assert
typeof
(
x
)
<:
Matrix
{
Float64
}
@
assert
size
(
x
)
==
(
4
,
10
)
end
# support for tuples, named tuples, dicts
for
(
x
,
y
)
in
eachobs
(
(
X
,
Y
)
)
# ...
end
There is
1
method for MLUtils.eachobs
:
The following pages link back here:
Custom learning tasks, Saving and loading models for inference
FastAI.jl , blocks/label.jl , datasets/Datasets.jl , FastTabular.jl , recipes.jl , FastVision.jl , encodings/imagepreprocessing.jl , recipes.jl , MLUtils.jl , deprecations.jl , eachobs.jl