cleaner chunk util

This commit is contained in:
Mike J Innes 2017-06-19 16:49:17 -07:00
parent b3ef370456
commit 0a6b6e1d6f
2 changed files with 3 additions and 2 deletions

View File

@ -4,7 +4,10 @@ using Base.Iterators: partition
partitionr(xs, n) = take(partition(xs, n), length(xs)÷n)
chunk(xs, n) = (partitionr(xs, length(xs)÷n)...,)
batches(xs, n) = (Batch([xs...]) for xs in partitionr(xs, n))
seqs(xs, n) = (Seq([xs...]) for xs in partitionr(xs, n))
# Stateful iteration

View File

@ -21,5 +21,3 @@ onecold(y::AbstractVector, labels = 1:length(y)) =
onecold(y::AbstractMatrix, l...) =
squeeze(mapslices(y -> onecold(y, l...), y, 2), 2)
chunk(xs, n) = Base.Iterators.partition(xs, length(xs)÷n)