Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
862 additions
and
664 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ LinearOperators | |
MAT | ||
PkgDev | ||
JLD | ||
BenchmarkTools | ||
BenchmarkTools | ||
DistributedArrays |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,45 @@ | ||
export reluActivation | ||
|
||
""" | ||
relu activation A = relu(Y) | ||
Input: | ||
Y - array of features | ||
Optional Input: | ||
doDerivative - flag for computing derivative, set via varargin | ||
Ex: reluActivation(Y,true); | ||
Output: | ||
A - activation | ||
dA - derivatives | ||
""" | ||
function reluActivation(Y::Array{T},doDerivative::Bool=false) where {T} | ||
|
||
Y = max.(Y,0); | ||
|
||
if doDerivative | ||
dA = sign(Y); | ||
else | ||
dA = zeros(T,0) | ||
end | ||
|
||
return A,dA | ||
end | ||
export reluActivation, reluActivation! | ||
|
||
""" | ||
relu activation A = relu(Y) | ||
Input: | ||
Y - array of features | ||
Optional Input: | ||
doDerivative - flag for computing derivative, set via varargin | ||
Ex: reluActivation(Y,true); | ||
Output: | ||
A - activation | ||
dA - derivatives | ||
""" | ||
function reluActivation(Y::Array{T},doDerivative::Bool=false) where {T} | ||
|
||
A = max.(Y,zero(T)); | ||
|
||
if doDerivative | ||
dA = sign.(A); | ||
else | ||
dA = zeros(T,0) | ||
end | ||
|
||
return A,dA | ||
end | ||
|
||
|
||
|
||
function reluActivation!(A::Array{T},dA,doDerivative::Bool=false) where {T} | ||
A .= max.(A,zero(T)); | ||
if doDerivative | ||
if isempty(dA) | ||
dA = sign.(A); | ||
else | ||
dA .= sign.(A); | ||
end | ||
end | ||
return A,dA | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.