diff --git a/src/Batches/batch.jl b/src/Batches/batch.jl index cbc21935..f1fbd812 100644 --- a/src/Batches/batch.jl +++ b/src/Batches/batch.jl @@ -6,9 +6,6 @@ end Batch(xs) = Batch(Storage(xs)) -convert{T,S}(::Type{Batch{T,S}},storage::S) = - Batch{T,S}(storage) - # TODO: figure out how to express this as a generic convert function rebatch(xs) dims = ndims(xs)-1 @@ -35,9 +32,6 @@ end Seq(xs) = Seq(Storage(xs)) -convert{T,S}(::Type{Seq{T,S}},storage::S) = - Seq{T,S}(storage) - BatchSeq{T<:Seq} = Batch{T} function rebatchseq(xs) diff --git a/src/Batches/catmat.jl b/src/Batches/catmat.jl index 6ce282e3..2c24f1c6 100644 --- a/src/Batches/catmat.jl +++ b/src/Batches/catmat.jl @@ -31,13 +31,12 @@ typename(b::Type{<:BatchLike}) = Juno.trim(collect(b))) end +convert{T,S}(B::Type{<:BatchLike{T,S}},storage::S) = B(storage) + struct Storage{T,S} <: BatchLike{T,S} data::S end -convert{T,S}(::Type{Storage{T,S}},storage::S) = - Storage{T,S}(storage) - allequal(xs) = all(x -> x == first(xs), xs) function (::Type{Storage{T,S}}){T,S}(xs, storage::S)