printing
This commit is contained in:
parent
f1dda12a54
commit
15c4f38130
@ -40,6 +40,17 @@ function back!(x::Var, Δ)
|
|||||||
back!(x.f, Δ)
|
back!(x.f, Δ)
|
||||||
end
|
end
|
||||||
|
|
||||||
for f in :[Base.size, Base.getindex].args
|
for f in :[Base.size, Base.ndims, Base.similar].args
|
||||||
@eval @inline $f(x::Var, a...) = $f(data(x), a...)
|
@eval @inline $f(x::Var, a...) = $f(data(x), a...)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Base.showarray(io::IO, X::Var, repr::Bool = true; header = true)
|
||||||
|
if repr
|
||||||
|
print(io, "Var(")
|
||||||
|
Base.showarray(io, data(X), true)
|
||||||
|
print(io, ")")
|
||||||
|
else
|
||||||
|
println(io, summary(X), ":")
|
||||||
|
Base.showarray(io, data(X), false, header = false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user