-
Notifications
You must be signed in to change notification settings - Fork 189
feat: activation intrinsics for neural networks #860
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
Merged
Merged
Changes from 45 commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
2ff7029
start working on activations module
jalvesz 7d1c6ad
softmax for ranks from 1 to 4
jalvesz c1303e7
move activations to specialfunctions, add specs
jalvesz f22756a
fix float constant definition
jalvesz b1a4180
fix float constant definition
jalvesz 90b8de3
fix float constant definition
jalvesz b7c8c81
Merge branch 'fortran-lang:master' into activations
jalvesz 1b3bf4f
update src CMakeLists
jalvesz f4ad250
add tests for activations
jalvesz 9d7eb7c
add tests for sigmoid and gelu
jalvesz 5727921
missing module procedure
jalvesz 2ed7626
missing interface and change of kind definition for elemental module …
jalvesz f1acf1e
add SiLU activation
jalvesz 230bea9
Merge branch 'fortran-lang:master' into activations
jalvesz dd7125d
Merge branch 'fortran-lang:master' into activations
jalvesz b137b36
Merge branch 'fortran-lang:master' into activations
jalvesz bc2bf5a
Merge branch 'fortran-lang:master' into activations
jalvesz 5c47bf0
add any rank support for softmax and logsoftmax
jalvesz 8f0cd69
Merge branch 'fortran-lang:master' into activations
jalvesz 1a2245a
Merge branch 'activations' of https://github.com/jalvesz/stdlib into …
jalvesz 5d0419e
homogenize arguments
jalvesz 21851d0
add selu activation
jalvesz ef6e3e6
Merge branch 'activations' of https://github.com/jalvesz/stdlib into …
jalvesz 1914e78
Add SELU documentation
jalvesz 4c1afde
add tests
jalvesz bccbdd4
examples
jalvesz 9b4ed49
fix relu example
jalvesz 564c99c
fix tests
jalvesz 9e9b28b
improve specs
jalvesz 14af3f9
examples bugfix
jalvesz 3789518
replace ifs with merge
jalvesz b36b143
Merge branch 'fortran-lang:master' into activations
jalvesz eedfad7
Merge branch 'fortran-lang:master' into activations
jalvesz 2cba1ee
Merge branch 'fortran-lang:master' into activations
jalvesz 8dc0654
Merge branch 'fortran-lang:master' into activations
jalvesz 9e0f026
Merge branch 'activations' of https://github.com/jalvesz/stdlib into …
jalvesz cdde132
Merge branch 'fortran-lang:master' into activations
jalvesz 4363271
Merge branch 'fortran-lang:master' into activations
jalvesz f06ab3b
Merge branch 'activations' of https://github.com/jalvesz/stdlib into …
jalvesz e483325
add leaky relu activation
jalvesz 20ecd43
Merge branch 'fortran-lang:master' into activations
jalvesz d5cfa36
Merge branch 'fortran-lang:master' into activations
jalvesz 1c3fbda
Merge branch 'fortran-lang:master' into activations
jalvesz 259360f
Merge branch 'fortran-lang:master' into activations
jalvesz 3519b43
Merge branch 'fortran-lang:master' into activations
jalvesz 0afc655
Update src/stdlib_specialfunctions.fypp
jalvesz 66e662c
lowercase procedure names
jalvesz ea74c87
single shape macro
jalvesz 9dacc48
Merge branch 'fortran-lang:master' into activations
jalvesz 5d41402
refactor tanh, add docs, tests on all real precisions
jalvesz d6ffa11
Merge branch 'fortran-lang:master' into activations
jalvesz 3090f53
use stdlib_sum
jalvesz 497600d
Merge branch 'fortran-lang:master' into activations
jalvesz c62110d
remove unused dim variable
jalvesz b1d64b9
Merge branch 'fortran-lang:master' into activations
jalvesz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
ADD_EXAMPLE(elu) | ||
ADD_EXAMPLE(gaussian) | ||
ADD_EXAMPLE(gelu) | ||
ADD_EXAMPLE(leaky_relu) | ||
ADD_EXAMPLE(relu) | ||
ADD_EXAMPLE(selu) | ||
ADD_EXAMPLE(silu) | ||
ADD_EXAMPLE(softmax) | ||
ADD_EXAMPLE(logsoftmax) | ||
ADD_EXAMPLE(softplus) | ||
ADD_EXAMPLE(step) |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
program example_elu | ||
use stdlib_kinds, only: sp | ||
use stdlib_math, only: linspace | ||
use stdlib_specialfunctions, only: elu | ||
implicit none | ||
integer, parameter :: n = 10 | ||
real(sp) :: x(n), y(n) | ||
|
||
x = linspace(-2._sp, 2._sp, n) | ||
y = elu( x , 1.0 ) | ||
print *, y | ||
end program example_elu | ||
|
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
program example_gaussian | ||
use stdlib_kinds, only: sp | ||
use stdlib_math, only: linspace | ||
use stdlib_specialfunctions, only: gaussian | ||
implicit none | ||
integer, parameter :: n = 10 | ||
real(sp) :: x(n), y(n) | ||
|
||
x = linspace(-2._sp, 2._sp, n) | ||
y = gaussian( x ) | ||
print *, y | ||
end program example_gaussian | ||
|
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
program example_gelu | ||
use stdlib_kinds, only: sp | ||
use stdlib_math, only: linspace | ||
use stdlib_specialfunctions, only: gelu | ||
implicit none | ||
integer, parameter :: n = 10 | ||
real(sp) :: x(n), y(n) | ||
|
||
x = linspace(-2._sp, 2._sp, n) | ||
y = gelu( x ) | ||
print *, y | ||
end program example_gelu | ||
|
13 changes: 13 additions & 0 deletions
13
example/specialfunctions_activations/example_leaky_relu.f90
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
program example_gelu | ||
use stdlib_kinds, only: sp | ||
use stdlib_math, only: linspace | ||
use stdlib_specialfunctions, only: leaky_relu | ||
implicit none | ||
integer, parameter :: n = 10 | ||
real(sp) :: x(n), y(n) | ||
|
||
x = linspace(-2._sp, 2._sp, n) | ||
y = leaky_relu( x , 0.1_sp ) | ||
print *, y | ||
end program example_gelu | ||
|
13 changes: 13 additions & 0 deletions
13
example/specialfunctions_activations/example_logsoftmax.f90
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
program example_logsoftmax | ||
use stdlib_kinds, only: sp | ||
use stdlib_math, only: linspace | ||
use stdlib_specialfunctions, only: logsoftmax | ||
implicit none | ||
integer, parameter :: n = 10 | ||
real(sp) :: x(n), y(n) | ||
|
||
x = linspace(-2._sp, 2._sp, n) | ||
y = logsoftmax( x ) | ||
print *, y | ||
end program example_logsoftmax | ||
|
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
program example_relu | ||
use stdlib_kinds, only: sp | ||
use stdlib_math, only: linspace | ||
use stdlib_specialfunctions, only: relu | ||
implicit none | ||
integer, parameter :: n = 10 | ||
real(sp) :: x(n), y(n) | ||
|
||
x = linspace(-2._sp, 2._sp, n) | ||
y = relu( x ) | ||
print *, y | ||
end program example_relu | ||
|
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
program example_selu | ||
use stdlib_kinds, only: sp | ||
use stdlib_math, only: linspace | ||
use stdlib_specialfunctions, only: selu | ||
implicit none | ||
integer, parameter :: n = 10 | ||
real(sp) :: x(n), y(n) | ||
|
||
x = linspace(-2._sp, 2._sp, n) | ||
y = selu( x ) | ||
print *, y | ||
end program example_selu | ||
|
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
program example_silu | ||
use stdlib_kinds, only: sp | ||
use stdlib_math, only: linspace | ||
use stdlib_specialfunctions, only: silu | ||
implicit none | ||
integer, parameter :: n = 10 | ||
real(sp) :: x(n), y(n) | ||
|
||
x = linspace(-2._sp, 2._sp, n) | ||
y = silu( x ) | ||
print *, y | ||
end program example_silu | ||
|
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
program example_softmax | ||
use stdlib_kinds, only: sp | ||
use stdlib_math, only: linspace | ||
use stdlib_specialfunctions, only: softmax | ||
implicit none | ||
integer, parameter :: n = 10 | ||
real(sp) :: x(n), y(n) | ||
|
||
x = linspace(-2._sp, 2._sp, n) | ||
y = softmax( x ) | ||
print *, y | ||
end program example_softmax | ||
|
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
program example_softplus | ||
use stdlib_kinds, only: sp | ||
use stdlib_math, only: linspace | ||
use stdlib_specialfunctions, only: softplus | ||
implicit none | ||
integer, parameter :: n = 10 | ||
real(sp) :: x(n), y(n) | ||
|
||
x = linspace(-2._sp, 2._sp, n) | ||
y = softplus( x ) | ||
print *, y | ||
end program example_softplus | ||
|
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
program example_step | ||
use stdlib_kinds, only: sp | ||
use stdlib_math, only: linspace | ||
use stdlib_specialfunctions, only: step | ||
implicit none | ||
integer, parameter :: n = 10 | ||
real(sp) :: x(n), y(n) | ||
|
||
x = linspace(-2._sp, 2._sp, n) | ||
y = step( x ) | ||
print *, y | ||
end program example_step | ||
|
This file contains hidden or 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 hidden or 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 was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.