From b79e536c13bed7e45dd55fec633be6fe036062c1 Mon Sep 17 00:00:00 2001 From: Mike J Innes Date: Thu, 26 Jan 2017 23:37:06 +0530 Subject: [PATCH] convertel for batch --- src/dims/batching.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/dims/batching.jl b/src/dims/batching.jl index 24dfc85d..fa8a4ce2 100644 --- a/src/dims/batching.jl +++ b/src/dims/batching.jl @@ -36,3 +36,7 @@ function rebatch(xs) B = Array{eltype(xs),dims+1} Batch{T,B}(xs) end + +convertel(T::Type, xs::Batch) = + isa(eltype(eltype(xs)), T) ? xs : + Batch(map(x->convertel(T, x), xs))