Closed
Description
The layer uses the normalise
(stateless) function as defined here. This function calculates mean and std on dims=1
but for images we need dims=(1,2,3)
leaving out only the batch dimension. The following function should work:
function normalise(x)
d = ndims(x) == 4 ? [1,2,3] : [1,]
mu = Flux.mean(x, dims=d)
sd = Flux.std(x, dims=d, mean=mu)
return (x.-mu)./sd
end
also the type of x
has to change in the function signature to allow for images, currently x::AbstractVecOrMat
fails for e.g. rand(Float32, 84,84,1,1)
since it allows only 1d or 2d arrays.