From 252e34e173ea3e05a198fc37969d2542eaab8526 Mon Sep 17 00:00:00 2001 From: Robert Luciani Date: Tue, 2 Oct 2018 21:39:00 +0200 Subject: [PATCH] 1.0+ updates - indices to axes, Vector init with undef --- src/utils.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils.jl b/src/utils.jl index c53f7864..6a970f0b 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -24,7 +24,7 @@ julia> chunk(1:10, 3) """ chunk(xs, n) = collect(Iterators.partition(xs, ceil(Int, length(xs)/n))) -batchindex(xs, i) = (reverse(Base.tail(reverse(indices(xs))))..., i) +batchindex(xs, i) = (reverse(Base.tail(reverse(axes(xs))))..., i) """ frequencies(xs) @@ -66,7 +66,7 @@ julia> batch([[1,2,3],[4,5,6]]) function batch(xs) data = first(xs) isa AbstractArray ? similar(first(xs), size(first(xs))..., length(xs)) : - Vector{eltype(xs)}(length(xs)) + Vector{eltype(xs)}(undef, length(xs)) for (i, x) in enumerate(xs) data[batchindex(data, i)...] = x end