From ae879cc5ebdef009fbbcfaec8b4c8b7e93dfc076 Mon Sep 17 00:00:00 2001 From: Michael Abbott Date: Sat, 13 Feb 2021 11:05:09 +0100 Subject: [PATCH] make Dense(x) prettier --- src/layers/basic.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/layers/basic.jl b/src/layers/basic.jl index 6eb7313ece..cae16801f6 100644 --- a/src/layers/basic.jl +++ b/src/layers/basic.jl @@ -143,11 +143,11 @@ end @functor Dense function (a::Dense)(x::AbstractArray) - W, b, σ = getfield(a, :weight), getfield(a, :bias), getfield(a, :σ) + W, b, σ = a.weight, a.bias, a.σ sz = size(x) - x = reshape(x, sz[1], :) # reshape to handle dims > 1 as batch dimensions - x = σ.(W*x .+ b) - return reshape(x, :, sz[2:end]...) + y = reshape(x, sz[1], :) # reshape to handle dims > 1 as batch dimensions + z = σ.(W*y .+ b) + return reshape(z, :, sz[2:end]...) end function Base.show(io::IO, l::Dense)