Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/layers/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ underscorise(n::Integer) =
join(reverse(join.(reverse.(Iterators.partition(digits(n), 3)))), '_')

function _nan_show(io::IO, x)
if !isempty(x) && _all(iszero, x)
if any(y -> y isa Zygote.AbstractGPUArray, x)
# These friendly warnings take 10-20 sec to compile the first time, for models on GPU.
printstyled(io, " (on GPU)", color=:light_black)
elseif !isempty(x) && _all(iszero, x)
printstyled(io, " (all zero)", color=:cyan)
elseif _any(isnan, x)
printstyled(io, " (some NaN)", color=:red)
Expand Down