From 433583233411d010d740d1d5010b59b203575a34 Mon Sep 17 00:00:00 2001 From: Kyle Daruwalla Date: Thu, 3 Nov 2022 13:40:25 -0500 Subject: [PATCH 1/2] Remove type restrictions on BN --- src/layers/normalise.jl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/layers/normalise.jl b/src/layers/normalise.jl index 0f2696a50a..aec11d6099 100644 --- a/src/layers/normalise.jl +++ b/src/layers/normalise.jl @@ -322,10 +322,10 @@ julia> isapprox(std(m(xs)), 1, atol=0.1) && std(xs) != std(m(xs)) true ``` """ -mutable struct BatchNorm{F,V,N,W} +mutable struct BatchNorm{F,V,U,N,W} λ::F # activation function β::V # bias - γ::V # scale + γ::U # scale μ::W # moving mean σ²::W # moving var ϵ::N @@ -412,10 +412,10 @@ julia> isapprox(std(y, dims=1:2), ones(1, 1, 3, 2), atol=0.2) && std(y, dims=1:2 true ``` """ -mutable struct InstanceNorm{F,V,N,W} +mutable struct InstanceNorm{F,V,U,N,W} λ::F # activation function β::V # bias - γ::V # scale + γ::U # scale μ::W # moving mean σ²::W # moving var ϵ::N @@ -510,11 +510,11 @@ julia> isapprox(std(y[:, :, 3:4, 2]), 1, atol=0.1) && std(xs[:, :, 3:4, 2]) != s true ``` """ -mutable struct GroupNorm{F,V,N,W} +mutable struct GroupNorm{F,V,U,N,W} G::Int # number of groups λ::F # activation function β::V # bias - γ::V # scale + γ::U # scale μ::W # moving mean σ²::W # moving std ϵ::N From fda24a25e5b6202125eefed0c3b18b014a0ddcc1 Mon Sep 17 00:00:00 2001 From: Kyle Daruwalla Date: Mon, 14 Nov 2022 14:17:17 -0500 Subject: [PATCH 2/2] Make type parameters prettier for normalization layers --- src/layers/normalise.jl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/layers/normalise.jl b/src/layers/normalise.jl index aec11d6099..d761ae7003 100644 --- a/src/layers/normalise.jl +++ b/src/layers/normalise.jl @@ -322,10 +322,10 @@ julia> isapprox(std(m(xs)), 1, atol=0.1) && std(xs) != std(m(xs)) true ``` """ -mutable struct BatchNorm{F,V,U,N,W} +mutable struct BatchNorm{F,B,S,N,W} λ::F # activation function - β::V # bias - γ::U # scale + β::B # bias + γ::S # scale μ::W # moving mean σ²::W # moving var ϵ::N @@ -412,10 +412,10 @@ julia> isapprox(std(y, dims=1:2), ones(1, 1, 3, 2), atol=0.2) && std(y, dims=1:2 true ``` """ -mutable struct InstanceNorm{F,V,U,N,W} +mutable struct InstanceNorm{F,B,S,N,W} λ::F # activation function - β::V # bias - γ::U # scale + β::B # bias + γ::S # scale μ::W # moving mean σ²::W # moving var ϵ::N @@ -510,11 +510,11 @@ julia> isapprox(std(y[:, :, 3:4, 2]), 1, atol=0.1) && std(xs[:, :, 3:4, 2]) != s true ``` """ -mutable struct GroupNorm{F,V,U,N,W} +mutable struct GroupNorm{F,B,S,N,W} G::Int # number of groups λ::F # activation function - β::V # bias - γ::U # scale + β::B # bias + γ::S # scale μ::W # moving mean σ²::W # moving std ϵ::N