-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More concise printing of detector type? #189
Comments
Yes, that would be an improvement. |
How about this? julia> for detector in (:TracerSparsityDetector, :TracerLocalSparsityDetector)
@eval function Base.show(io::IO, d::$detector{GradientTracer{PG}, HessianTracer{PH}}; indent=0) where {PG,PH}
println(io, $detector, "{")
println(io, " ", "GradientTracer pattern: ", PG)
println(io, " ", "HessianTracer pattern: ", PH)
print(io, "}")
return nothing
end
end
julia> TracerSparsityDetector()
TracerSparsityDetector{
GradientTracer pattern: SparseConnectivityTracer.IndexSetGradientPattern{Int64, BitSet}
HessianTracer pattern: SparseConnectivityTracer.DictHessianPattern{Int64, BitSet, Dict{Int64, BitSet}, SparseConnectivityTracer.NotShared}
} Or should we just print |
Ideally, |
I'm wondering if we can make the printing of
TracerSparsityDetector()
shorter. At the moment it looks likeBut we don't have to specify all type parameters if they correspond to the default settings. You can draw inspiration from the new printing I coded for ADTypes, which only tries to reproduce the constructor. See example here:
https://github.com/SciML/ADTypes.jl/blob/f206682addbc27b450f51d51e9a4082fb9b7cdb4/src/dense.jl#L190-L196
The text was updated successfully, but these errors were encountered: