Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove type restrictions on normalization layers' scale and bias #2099

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/layers/normalise.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know where the original type param names came from, but would it make sense to harmonize them with the actual parameter names? e.g. B,S instead of U,V.

μ::W # moving mean
σ²::W # moving var
ϵ::N
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down