show methods
This commit is contained in:
parent
0a6b6e1d6f
commit
ea5d43ed77
@ -97,6 +97,14 @@ end
|
|||||||
|
|
||||||
mxnet(model, ctx = :cpu) = Model(model, toctx(ctx))
|
mxnet(model, ctx = :cpu) = Model(model, toctx(ctx))
|
||||||
|
|
||||||
|
function Base.show(io::IO, m::Model)
|
||||||
|
print(io, "MX.Model(")
|
||||||
|
show(io, m.model)
|
||||||
|
print(io, ", ")
|
||||||
|
show(io, m.ctx)
|
||||||
|
print(io, ")")
|
||||||
|
end
|
||||||
|
|
||||||
import Base: @get!
|
import Base: @get!
|
||||||
|
|
||||||
# TODO: dims having its own type would be useful
|
# TODO: dims having its own type would be useful
|
||||||
|
@ -35,3 +35,5 @@ end
|
|||||||
(m::Capacitor)(xs...) = interpmodel(m, xs...)
|
(m::Capacitor)(xs...) = interpmodel(m, xs...)
|
||||||
|
|
||||||
graph(cap::Capacitor) = cap.graph
|
graph(cap::Capacitor) = cap.graph
|
||||||
|
|
||||||
|
Base.show(io::IO, ::Capacitor) = print(io, "Capacitor(...)")
|
||||||
|
@ -9,6 +9,12 @@ end
|
|||||||
|
|
||||||
Stateful(model, ss) = Stateful(model, ss, state.(ss), state.(ss))
|
Stateful(model, ss) = Stateful(model, ss, state.(ss), state.(ss))
|
||||||
|
|
||||||
|
function Base.show(io::IO, m::Stateful)
|
||||||
|
print(io, "Stateful(")
|
||||||
|
show(io, m.model)
|
||||||
|
print(io, ")")
|
||||||
|
end
|
||||||
|
|
||||||
function (m::Stateful)(xs...)
|
function (m::Stateful)(xs...)
|
||||||
m.istate = m.ostate
|
m.istate = m.ostate
|
||||||
state, y = m.model((m.istate...,), xs...)
|
state, y = m.model((m.istate...,), xs...)
|
||||||
|
Loading…
Reference in New Issue
Block a user