move batch and seq together
This commit is contained in:
parent
a7a46e3a82
commit
8e019e0f30
@ -9,7 +9,6 @@ export CatMat, rawbatch,
|
|||||||
|
|
||||||
include("catmat.jl")
|
include("catmat.jl")
|
||||||
include("batch.jl")
|
include("batch.jl")
|
||||||
include("seq.jl")
|
|
||||||
include("iter.jl")
|
include("iter.jl")
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# Batches
|
||||||
|
|
||||||
struct Batch{T,S} <: ABatch{T}
|
struct Batch{T,S} <: ABatch{T}
|
||||||
data::CatMat{T,S}
|
data::CatMat{T,S}
|
||||||
end
|
end
|
||||||
@ -32,3 +34,32 @@ batchone(x::Batch) = x
|
|||||||
|
|
||||||
tobatch(xs::Batch) = rawbatch(xs)
|
tobatch(xs::Batch) = rawbatch(xs)
|
||||||
tobatch(xs) = tobatch(batchone(xs))
|
tobatch(xs) = tobatch(batchone(xs))
|
||||||
|
|
||||||
|
# Sequences
|
||||||
|
|
||||||
|
struct Seq{T,S} <: ABatch{T}
|
||||||
|
data::CatMat{T,S}
|
||||||
|
end
|
||||||
|
|
||||||
|
@forward Seq.data size, eltype, getindex, setindex!, rawbatch
|
||||||
|
|
||||||
|
Seq(xs) = Seq(CatMat(xs))
|
||||||
|
|
||||||
|
convert{T,S}(::Type{Seq{T,S}},storage::S) =
|
||||||
|
Seq{T,S}(storage)
|
||||||
|
|
||||||
|
@render Juno.Inline b::Seq begin
|
||||||
|
Tree(Row(Text("Seq of "), eltype(b),
|
||||||
|
Juno.fade("[$(length(b))]")),
|
||||||
|
Juno.trim(collect(b)))
|
||||||
|
end
|
||||||
|
|
||||||
|
BatchSeq{T<:Seq} = Batch{T}
|
||||||
|
|
||||||
|
function rebatchseq(xs)
|
||||||
|
dims = ndims(xs)-2
|
||||||
|
T = Array{eltype(xs),dims}
|
||||||
|
S = Array{eltype(xs),dims+1}
|
||||||
|
B = Array{eltype(xs),dims+2}
|
||||||
|
Batch{Seq{T,S},B}(xs)
|
||||||
|
end
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
struct Seq{T,S} <: ABatch{T}
|
|
||||||
data::CatMat{T,S}
|
|
||||||
end
|
|
||||||
|
|
||||||
@forward Seq.data size, eltype, getindex, setindex!, rawbatch
|
|
||||||
|
|
||||||
Seq(xs) = Seq(CatMat(xs))
|
|
||||||
|
|
||||||
convert{T,S}(::Type{Seq{T,S}},storage::S) =
|
|
||||||
Seq{T,S}(storage)
|
|
||||||
|
|
||||||
@render Juno.Inline b::Seq begin
|
|
||||||
Tree(Row(Text("Seq of "), eltype(b),
|
|
||||||
Juno.fade("[$(length(b))]")),
|
|
||||||
Juno.trim(collect(b)))
|
|
||||||
end
|
|
||||||
|
|
||||||
BatchSeq{T<:Seq} = Batch{T}
|
|
||||||
|
|
||||||
function rebatchseq(xs)
|
|
||||||
dims = ndims(xs)-2
|
|
||||||
T = Array{eltype(xs),dims}
|
|
||||||
S = Array{eltype(xs),dims+1}
|
|
||||||
B = Array{eltype(xs),dims+2}
|
|
||||||
Batch{Seq{T,S},B}(xs)
|
|
||||||
end
|
|
Loading…
Reference in New Issue
Block a user