athena__activation_sigmoid Module

Module containing implementation of the sigmoid activation function

This module implements the logistic sigmoid function that squashes inputs to the range (0, 1), commonly used for binary classification.

Mathematical operation:

Derivative:

Properties: Smooth, bounded , saturates for large Output interpretation: Can be viewed as probability for binary events


Uses


Interfaces

public interface sigmoid_actv_type

  • private function initialise(scale, attributes) result(activation)

    Initialise a sigmoid activation function

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real32), intent(in), optional :: scale

    Optional scale factor for activation output

    type(onnx_attribute_type), intent(in), optional, dimension(:) :: attributes

    Optional array of ONNX attributes

    Return Value type(sigmoid_actv_type)

    Sigmoid activation type


Derived Types

type, public, extends(base_actv_type) ::  sigmoid_actv_type

Type for sigmoid activation function with overloaded procedures

Components

Type Visibility Attributes Name Initial
logical, public :: apply_scaling = .false.

Boolean to apply scaling or not

character(len=10), public :: name

Name of the activation function

real(kind=real32), public :: scale = 1._real32

Scale of the activation function

real(kind=real32), public :: threshold

Threshold of the activation function

Constructor

private function initialise (scale, attributes)

Initialise a sigmoid activation function

Type-Bound Procedures

procedure, public, pass(this) :: apply => apply_sigmoid
procedure, public, pass(this) :: apply_attributes => apply_attributes_sigmoid
procedure, public, pass(this) :: export_attributes => export_attributes_sigmoid
procedure, public, pass(this) :: print_to_unit => print_to_unit_actv
procedure, public, pass(this) :: reset => reset_sigmoid

Functions

public function create_from_onnx_sigmoid_activation(attributes) result(activation)

Create sigmoid activation function from ONNX attributes

Arguments

Type IntentOptional Attributes Name
type(onnx_attribute_type), intent(in), dimension(:) :: attributes

Array of ONNX attributes

Return Value class(base_actv_type), allocatable

Instance of activation type

private function apply_sigmoid(this, val) result(output)

Apply sigmoid activation to 1D array

Read more…

Arguments

Type IntentOptional Attributes Name
class(sigmoid_actv_type), intent(in) :: this

Sigmoid activation type

type(array_type), intent(in) :: val

Input values

Return Value type(array_type), pointer

Activated output values in range [0,1]

private pure function export_attributes_sigmoid(this) result(attributes)

Export sigmoid activation function attributes as ONNX attributes

Arguments

Type IntentOptional Attributes Name
class(sigmoid_actv_type), intent(in) :: this

Sigmoid activation type

Return Value type(onnx_attribute_type), allocatable, dimension(:)

Array of ONNX attributes

private function initialise(scale, attributes) result(activation)

Initialise a sigmoid activation function

Arguments

Type IntentOptional Attributes Name
real(kind=real32), intent(in), optional :: scale

Optional scale factor for activation output

type(onnx_attribute_type), intent(in), optional, dimension(:) :: attributes

Optional array of ONNX attributes

Return Value type(sigmoid_actv_type)

Sigmoid activation type


Subroutines

private subroutine apply_attributes_sigmoid(this, attributes)

Load ONNX attributes into sigmoid activation function

Arguments

Type IntentOptional Attributes Name
class(sigmoid_actv_type), intent(inout) :: this

Sigmoid activation type

type(onnx_attribute_type), intent(in), dimension(:) :: attributes

Array of ONNX attributes

private pure subroutine reset_sigmoid(this)

Reset sigmoid activation function attributes and variables

Arguments

Type IntentOptional Attributes Name
class(sigmoid_actv_type), intent(inout) :: this

Sigmoid activation type