remove iterators
This commit is contained in:
parent
66c0403ffd
commit
72e8e5c7f9
1
REQUIRE
1
REQUIRE
@ -1,5 +1,4 @@
|
|||||||
julia 0.6.0-pre
|
julia 0.6.0-pre
|
||||||
Iterators
|
|
||||||
DataFlow
|
DataFlow
|
||||||
Juno
|
Juno
|
||||||
MacroTools 0.3.3
|
MacroTools 0.3.3
|
||||||
|
10
src/data.jl
10
src/data.jl
@ -22,15 +22,7 @@ onecold(y::AbstractVector, labels = 1:length(y)) =
|
|||||||
onecold(y::AbstractMatrix, l...) =
|
onecold(y::AbstractMatrix, l...) =
|
||||||
squeeze(mapslices(y -> onecold(y, l...), y, 2), 2)
|
squeeze(mapslices(y -> onecold(y, l...), y, 2), 2)
|
||||||
|
|
||||||
using Iterators
|
chunk(xs, n) = Base.Iterators.partition(xs, length(xs)÷n)
|
||||||
import Iterators: Partition, partition
|
|
||||||
|
|
||||||
Base.length(l::Partition) = length(l.xs) ÷ l.step
|
|
||||||
|
|
||||||
_partition(r::UnitRange, step::Integer) = (step*(i-1)+1:step*i for i in 1:(r.stop÷step))
|
|
||||||
_partition(xs, step) = (xs[i] for i in _partition(1:length(xs), step))
|
|
||||||
|
|
||||||
chunk(xs, n) = _partition(xs, length(xs)÷n)
|
|
||||||
|
|
||||||
batches(xs...) = (Batch(x) for x in zip(xs...))
|
batches(xs...) = (Batch(x) for x in zip(xs...))
|
||||||
sequences(xs, len) = (Seq(x) for x in partition(xs, len))
|
sequences(xs, len) = (Seq(x) for x in partition(xs, len))
|
||||||
|
Loading…
Reference in New Issue
Block a user