Skip to content

Commit ae879cc

Browse files
author
Michael Abbott
committed
make Dense(x) prettier
1 parent 5a27ff5 commit ae879cc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/layers/basic.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,11 @@ end
143143
@functor Dense
144144

145145
function (a::Dense)(x::AbstractArray)
146-
W, b, σ = getfield(a, :weight), getfield(a, :bias), getfield(a, )
146+
W, b, σ = a.weight, a.bias, a.σ
147147
sz = size(x)
148-
x = reshape(x, sz[1], :) # reshape to handle dims > 1 as batch dimensions
149-
x = σ.(W*x .+ b)
150-
return reshape(x, :, sz[2:end]...)
148+
y = reshape(x, sz[1], :) # reshape to handle dims > 1 as batch dimensions
149+
z = σ.(W*y .+ b)
150+
return reshape(z, :, sz[2:end]...)
151151
end
152152

153153
function Base.show(io::IO, l::Dense)

0 commit comments

Comments
 (0)