Flux.jl/src/dims/batching.jl

22 lines
457 B
Julia
Raw Normal View History

2016-12-15 21:37:07 +00:00
export Batch, batchone
2016-10-25 12:48:30 +00:00
immutable Batch{T,S} <: AbstractVector{T}
data::CatMat{T,S}
end
@forward Batch.data size, eltype, getindex, setindex!, rawbatch
Batch(xs) = Batch(CatMat(xs))
convert{T,S}(::Type{Batch{T,S}},storage::S) =
Batch{T,S}(storage)
2016-12-15 21:37:07 +00:00
batchone(x) = Batch((x,))
batchone(x::Batch) = x
2016-10-25 12:48:30 +00:00
@render Juno.Inline b::Batch begin
Tree(Row(Text("Batch of "), eltype(b),
Juno.fade("[$(length(b))]")),
Juno.trim(collect(b)))
end