suspiciously similar seq data structure

This commit is contained in:
Mike J Innes 2016-10-25 14:10:49 +01:00
parent 95b955246d
commit 46550e4863
2 changed files with 22 additions and 0 deletions

View File

@ -20,6 +20,7 @@ include("layers/shims.jl")
include("dims/catmat.jl")
include("dims/batching.jl")
include("dims/seq.jl")
include("cost.jl")
include("activation.jl")

21
src/dims/seq.jl Normal file
View File

@ -0,0 +1,21 @@
export seq, Seq
immutable Seq{T,S} <: AbstractVector{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)
Media.render{T<:Seq}(i::Juno.Inline, b::Type{T}) =
render(i, Row(Juno.typ("Seq"), text"{", eltype(T), text"}"))
@render Juno.Inline b::Seq begin
Tree(Row(Text("Seq of "), eltype(b),
Juno.fade("[$(length(b))]")),
Juno.trim(collect(b)))
end