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

Make bias optional #873

Merged
merged 41 commits into from
May 1, 2020
Merged
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
5ea6a33
make bias optional
Sep 27, 2019
9f2ac8f
ditto remaining conv layers
Sep 27, 2019
a801fcb
docstrings
Sep 27, 2019
dced8c0
use ZeroType
Oct 1, 2019
1fe3217
add to docs
Oct 1, 2019
55ef7c1
add weight and bias kwargs
Oct 5, 2019
48a305b
ditto remaining layers
Oct 5, 2019
e97d61f
fixes
Oct 5, 2019
d00f833
rm ZeroType
Oct 5, 2019
2ae3ad3
doc fixes
Oct 5, 2019
214f71f
add N
Oct 5, 2019
a1e826b
fixes
Oct 5, 2019
f3904b4
add ZeroType back
Oct 8, 2019
040697f
add bias and weight kwarg
Oct 8, 2019
b596faa
tests bias switch
Oct 8, 2019
95c5845
document bias switch
Oct 8, 2019
49ea43e
ZeroType => Zeros
Oct 8, 2019
c85bad4
replace weight with filter
Oct 8, 2019
4a183ae
make Zeros a dimensionlesss number
Oct 22, 2019
7c90fb4
use array to define Zeros
Oct 23, 2019
a4a987f
hook into bcasting
Nov 7, 2019
e89b8eb
fixes
Nov 12, 2019
eb41715
define manual rules
Nov 19, 2019
2455630
cleaner API
Nov 27, 2019
ec872bb
test that bias has no grads with Zeros
Nov 27, 2019
f39e184
rm Zeros warning
Dec 9, 2019
894c075
rm Zeros setindex
Dec 9, 2019
a72ca2b
fix args
Dec 9, 2019
b9fbee1
::typeof(op) -> op
Jan 31, 2020
bc20103
no-op copy
Jan 31, 2020
f889d0c
add kwarg constructors
Feb 26, 2020
58211e3
docs improve
Feb 26, 2020
cd93179
more docs and constructors
Feb 26, 2020
cf82393
type signatures
Feb 26, 2020
20e78e2
docs fix
Feb 26, 2020
7e308e7
rm unneccesary fns
Mar 4, 2020
d8e44fc
correct broadcasting for addition
Mar 4, 2020
5086c0f
merge conflicts
Apr 29, 2020
534809a
move zeros to its own file
Apr 29, 2020
29215fa
comment on possible future deprecations
Apr 29, 2020
8f877f2
quick fix
MikeInnes May 1, 2020
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
Prev Previous commit
Next Next commit
add kwarg constructors
  • Loading branch information
Dhairya Gandhi committed Feb 26, 2020
commit f889d0c4d4fd03c5209d66f640e05f7c48cbd454
15 changes: 15 additions & 0 deletions src/layers/conv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ function Conv(w::AbstractArray{T,N}, b::Union{Zeros, AbstractVector{T}}, σ = id
return Conv(σ, w, b, stride, pad, dilation)
end

function Conv(;weight::AbstractArray, bias::Union{Zeros, AbstractVector{T}}, activation = identity,
stride = 1, pad = 0, dilation = 1) where {T,N}
Conv(weight, bias, activation, stride = stride, pad = pad, dilation = dilation)
end

"""
convfilter(filter::Tuple, in=>out)

Expand Down Expand Up @@ -144,6 +149,11 @@ function ConvTranspose(w::AbstractArray{T,N}, b::Union{Zeros, AbstractVector{T}}
return ConvTranspose(σ, w, b, stride, pad, dilation)
end

function ConvTranspose(;weight::AbstractArray{T,N}, bias::Union{Zeros, AbstractVector{T}},
activation = identity, stride = 1, pad = 0, dilation = 1) where {T,N}
ConvTranspose(weight, bias, activation, stride = stride, pad = pad, dilation = dilation)
end

function ConvTranspose(k::NTuple{N,Integer}, ch::Pair{<:Integer,<:Integer}, σ = identity;
init = glorot_uniform, stride = 1, pad = 0, dilation = 1,
weight = convfilter(k, reverse(ch), init = init), bias = zeros(ch[2])) where N
Expand Down Expand Up @@ -233,6 +243,11 @@ function DepthwiseConv(w::AbstractArray{T,N}, b::Union{Zeros, AbstractVector{T}}
return DepthwiseConv(σ, w, b, stride, pad, dilation)
end

function DepthwiseConv(;weight::AbstractArray, bias::Union{Zeros, AbstractVector{T}},
activation = identity, stride = 1, pad = 0, dilation = 1) where {T,N}
DepthwiseConv(weight, bias, activation, stride = stride, pad = pad, dilation = dilation)
end

"""
depthwiseconvfilter(filter::Tuple, in=>out)

Expand Down