move batchone util

This commit is contained in:
Mike J Innes 2016-12-15 21:37:07 +00:00
parent 52cd621fb6
commit a330b394bd
2 changed files with 4 additions and 4 deletions

View File

@ -16,9 +16,6 @@ function tf(model)
gradients(output, input))
end
batchone(x) = Batch((x,))
batchone(x::Batch) = x
function batch(xs)
dims = ndims(xs)-1
T = Array{eltype(xs),dims}

View File

@ -1,4 +1,4 @@
export Batch
export Batch, batchone
immutable Batch{T,S} <: AbstractVector{T}
data::CatMat{T,S}
@ -11,6 +11,9 @@ Batch(xs) = Batch(CatMat(xs))
convert{T,S}(::Type{Batch{T,S}},storage::S) =
Batch{T,S}(storage)
batchone(x) = Batch((x,))
batchone(x::Batch) = x
Media.render{T<:Batch}(i::Juno.Inline, b::Type{T}) =
render(i, Row(Juno.typ("Batch"), text"{", eltype(T), text"}"))