@@ -77,8 +77,9 @@ function _layer_show(io::IO, layer, indent::Int=0, name=nothing)
77
77
print (io, " " ^ indent, str, indent== 0 ? " " : " ," )
78
78
if ! isempty (params (layer))
79
79
print (io, " " ^ max (2 , (indent== 0 ? 20 : 39 ) - indent - length (str)))
80
- printstyled (io, " # " , underscorise (sum (length, params (layer))), " parameters" ; color= :light_black )
81
- nonparam = _childarray_sum (length, layer) - sum (length, params (layer))
80
+ printstyled (io, " # " , underscorise (sum (length, params (layer); init= 0 )), " parameters" ;
81
+ color= :light_black )
82
+ nonparam = _childarray_sum (length, layer) - sum (length, params (layer), init= 0 )
82
83
if nonparam > 0
83
84
printstyled (io, " , plus " , underscorise (nonparam), indent== 0 ? " non-trainable" : " " ; color= :light_black )
84
85
end
90
91
function _big_finale (io:: IO , m)
91
92
ps = params (m)
92
93
if length (ps) > 2
93
- pars = underscorise (sum (length, ps))
94
+ pars = underscorise (sum (length, ps; init = 0 ))
94
95
bytes = Base. format_bytes (Base. summarysize (m))
95
96
noncnt = _childarray_sum (_-> 1 , m) - length (ps)
96
97
if noncnt > 0
97
- nonparam = underscorise (_childarray_sum (length, m) - sum (length, ps))
98
+ nonparam = underscorise (_childarray_sum (length, m) - sum (length, ps; init = 0 ))
98
99
printstyled (io, " " ^ 08 , " # Total: " , length (ps), " trainable arrays, " ; color= :light_black )
99
100
println (io, pars, " parameters," )
100
101
printstyled (io, " " ^ 10 , " # plus " , noncnt, " non-trainable, " , nonparam, " parameters, summarysize " ; color= :light_black )
@@ -107,7 +108,8 @@ function _big_finale(io::IO, m)
107
108
end
108
109
109
110
_childarray_sum (f, x:: AbstractArray{<:Number} ) = f (x)
110
- _childarray_sum (f, x) = isleaf (x) ? 0 : sum (y -> _childarray_sum (f, y), Functors. children (x))
111
+ _childarray_sum (f, x) = isleaf (x) ? 0 : sum (y -> _childarray_sum (f, y), Functors. children (x),
112
+ init= 0 )
111
113
112
114
# utility functions
113
115
0 commit comments