improve printing

This commit is contained in:
Mike J Innes 2016-08-31 06:29:52 +01:00
parent abcb6d6351
commit 6503496c39
3 changed files with 8 additions and 2 deletions

View File

@ -8,7 +8,7 @@ type MXModel <: Model
end
Base.show(io::IO, m::MXModel) =
print(io, "MXModel($(unblock(syntax(Flux.graph(m.model)))))")
print(io, "MXModel($(m.model))")
mxdims(dims::NTuple) =
length(dims) == 1 ? (1, dims...) : reverse(dims)

View File

@ -26,5 +26,11 @@ end
back!(s::Chain, ) = foldr((m, ) -> back!(m, ), , s.layers)
update!(s::Chain, η) = foreach(l -> update!(l, η), s.layers)
function Base.show(io::IO, c::Chain)
print(io, "Chain(")
print_joined(io, c.layers, ", ")
print(io, ")")
end
graph(s::Chain) =
foldl((v, m) -> vertex(m, v), constant(ModelInput(1)), s.layers)

View File

@ -12,7 +12,7 @@ Dense(in::Integer, out::Integer; init = initn) =
Dense(init(out, in), init(out))
Base.show(io::IO, d::Dense) =
print(io, "Flux.Dense($(size(d.W.x,2)),$(size(d.W.x,1)))")
print(io, "Dense($(size(d.W.x,2)),$(size(d.W.x,1)))")
@model type Sigmoid
layer::Model