Gaussian
- Gaussian functionExperimental
Computes the gaussian function:
result =
gaussian (x)
Elemental function
x
: Shall be a scalar or array of any real
kind.
The function returns a value with the same type and kind as input argument.
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
Gaussian_grad
- Gradient of the Gaussian functionExperimental
Computes the gradient of the gaussian function:
result =
gaussian_grad (x)
Elemental function
x
: Shall be a scalar or array of any real
kind.
The function returns a value with the same type and kind as input argument.
Elu
- Exponential Linear Unit functionExperimental
Computes the gaussian function:
result =
elu (x,a)
Elemental function
x
: Shall be a scalar or array of any real
kind.
a
: Shall be a scalar or array of any real
kind.
The function returns a value with the same type and kind as input argument.
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
Elu_grad
- Gradient of the Exponential Linear Unit functionExperimental
Computes the gradient of the gaussian function:
result =
elu_grad (x,a)
Elemental function
x
: Shall be a scalar or array of any real
kind.
a
: Shall be a scalar or array of any real
kind.
The function returns a value with the same type and kind as input argument.
Relu
- Rectified Linear Unit functionExperimental
Computes the Rectified Linear Unit function:
result =
relu (x)
Elemental function
x
: Shall be a scalar or array of any real
kind.
The function returns a value with the same type and kind as input argument.
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
Relu_grad
- Gradient of the Rectified Linear Unit functionExperimental
Computes the gradient of the gaussian function:
result =
relu_grad (x)
Elemental function
x
: Shall be a scalar or array of any real
kind.
The function returns a value with the same type and kind as input argument.
leaky_relu
- leaky Rectified Linear Unit functionExperimental
Computes the gaussian function:
result =
leaky_relu (x,a)
Elemental function
x
: Shall be a scalar or array of any real
kind.
a
: Shall be a scalar or array of any real
kind.
The function returns a value with the same type and kind as input argument.
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
leaky_relu_grad
- Gradient of the leaky Rectified Linear Unit functionExperimental
Computes the gradient of the leaky_relu function:
result =
leaky_relu_grad (x,a)
Elemental function
x
: Shall be a scalar or array of any real
kind.
a
: Shall be a scalar or array of any real
kind.
The function returns a value with the same type and kind as the input argument.
Gelu
- Gaussian Error Linear Unit functionExperimental
Computes the Gaussian Error Linear Unit function:
result =
gelu (x)
Elemental function
x
: Shall be a scalar or array of any real
kind.
The function returns a value with the same type and kind as input argument.
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
Gelu_grad
- Gradient of the Gaussian Error Linear Unit functionExperimental
Computes the gradient of the gaussian error linear unit function:
result =
gelu_grad (x)
Elemental function
x
: Shall be a scalar or array of any real
kind.
The function returns a value with the same type and kind as input argument.
Gelu_approx
- Approximation of the Gaussian Error Linear Unit functionExperimental
Computes a fast approximation of the Gaussian Error Linear Unit function using a fast $\text{erf}$ approximation:
result =
gelu_approx (x)
Elemental function
x
: Shall be a scalar or array of any real
kind.
The function returns a value with the same type and kind as input argument.
Gelu_approx_grad
- Gradient of the Approximated Gaussian Error Linear Unit functionExperimental
Computes the gradient of the gaussian error linear unit function using a fast $\text{erf}$ approximation:
result =
gelu_approx_grad (x)
Elemental function
x
: Shall be a scalar or array of any real
kind.
The function returns a value with the same type and kind as input argument.
Selu
- Scaled Exponential Linear Unit functionExperimental
Applies the Scaled Exponential Linear Unit activation function: Where, and
result =
selu (x)
Elemental function
x
: Shall be a scalar or array of any real
kind.
The function returns a value with the same type and kind as input argument.
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
selu_grad
- Gradient of the Scaled Exponential Linear Unit functionExperimental
Applies the gradient of the Scaled Exponential Linear Unit activation function:
result =
selu_grad (x)
Elemental function
x
: Shall be a scalar or array of any real
kind.
The function returns a value with the same type and kind as input argument.
Sigmoid
- Sigmoid functionExperimental
Computes the sigmoid function:
result =
sigmoid (x)
Elemental function
x
: Shall be a scalar or array of any real
kind.
The function returns a value with the same type and kind as input argument.
Sigmoid_grad
- Gradient of the Sigmoid functionExperimental
Computes the gradient of the Sigmoid function:
result =
sigmoid_grad (x)
Elemental function
x
: Shall be a scalar or array of any real
kind.
The function returns a value with the same type and kind as input argument.
SiLU
- Sigmoid Linear Unit functionExperimental
Computes the Sigmoid Linear Unit function:
result =
silu (x)
Elemental function
x
: Shall be a scalar or array of any real
kind.
The function returns a value with the same type and kind as input argument.
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
Silu_grad
- Gradient of the Sigmoid Linear Unit functionExperimental
Computes the gradient of the Sigmoid function:
result =
silu_grad (x)
Elemental function
x
: Shall be a scalar or array of any real
kind.
The function returns a value with the same type and kind as input argument.
Step
- Step functionExperimental
Computes the step function:
result =
step (x)
Elemental function
x
: Shall be a scalar or array of any real
kind.
The function returns a value with the same type and kind as input argument.
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
step_grad
- Gradient of the Step functionExperimental
Computes the gradient of the Sigmoid function:
result =
step_grad (x)
Elemental function
x
: Shall be a scalar or array of any real
kind.
The function returns a value with the same type and kind as input argument.
softmax
- softmax functionExperimental
Computes the softmax function:
result =
softmax (x,dim)
Pure function for ranks 1 to 4.
x
: Shall be an array of rank 1 to 4 of any real
kind.
dim
: integer scalar indicating upon which dimension to apply the normalization.
The function returns an array with the same rank and kind as the input argument x
.
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
softmax_grad
- Gradient of the softmax functionExperimental
Computes the gradient of the softmax function:
result =
softmax_grad (x,dim)
Pure function for ranks 1 to 4.
x
: Shall be an array of rank 1 to 4 of any real
kind.
dim
: integer scalar indicating upon which dimension to apply the normalization.
The function returns a value with the same type and kind as input argument.
softplus
- softplus functionExperimental
Computes the softplus function:
result =
softplus (x)
Elemental function
x
: Shall be a scalar or array of any real
kind.
The function returns a value with the same type and kind as input argument.
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
softplus_grad
- Gradient of the softplus functionExperimental
Computes the gradient of the softplus function:
result =
softplus_grad (x)
Elemental function
x
: Shall be a scalar or array of any real
kind.
The function returns a value with the same type and kind as input argument.
Fast tanh
- Approximation of the hyperbolic tangent functionExperimental
Computes an approximated but faster solution to:
result =
fast_tanh (x)
Elemental function
x
: Shall be a scalar or array of any real
kind.
The function returns a value with the same type and kind as input argument.
fast_tanh_grad
- Gradient of the approximation of the hyperbolic tangent functionExperimental
Computes the gradient of the fast_tanh
function:
result =
fast_tanh_grad (x)
Elemental function
x
: Shall be a scalar or array of any real
kind.
The function returns a value with the same type and kind as input argument.
Fast erf
- Approximation of the error functionExperimental
Computes an approximated but faster solution to:
result =
fast_erf (x)
Elemental function
x
: Shall be a scalar or array of any real
kind.
The function returns a value with the same type and kind as input argument.