athena__diffstruc_extd_submodule Submodule

Submodule containing implementations for extended diffstruc array operations


Uses


Functions

function get_partial_add(this, upstream_grad) result(output)

Get partial derivative with respect to left operand

Arguments

Type IntentOptional Attributes Name
class(array_type), intent(inout) :: this
type(array_type), intent(in) :: upstream_grad

Return Value type(array_type)

function get_partial_add_bias(this, upstream_grad) result(output)

Get partial derivative with respect to bias operand

Arguments

Type IntentOptional Attributes Name
class(array_type), intent(inout) :: this
type(array_type), intent(in) :: upstream_grad

Return Value type(array_type)

function get_partial_piecewise(this, upstream_grad) result(output)

Get partial derivative of piecewise activation

Arguments

Type IntentOptional Attributes Name
class(array_type), intent(inout) :: this
type(array_type), intent(in) :: upstream_grad

Return Value type(array_type)

function get_partial_softmax(this, upstream_grad) result(output)

Get partial derivative of softmax activation

Arguments

Type IntentOptional Attributes Name
class(array_type), intent(inout) :: this
type(array_type), intent(in) :: upstream_grad

Return Value type(array_type)

function get_partial_softmax_reverse_left(this, upstream_grad) result(output)

Get partial derivative of softmax reverse operation

Arguments

Type IntentOptional Attributes Name
class(array_type), intent(inout) :: this
type(array_type), intent(in) :: upstream_grad

Return Value type(array_type)

function get_partial_softmax_reverse_right(this, upstream_grad) result(output)

Get partial derivative of softmax reverse operation

Arguments

Type IntentOptional Attributes Name
class(array_type), intent(inout) :: this
type(array_type), intent(in) :: upstream_grad

Return Value type(array_type)

function get_partial_swish(this, upstream_grad) result(output)

Get partial derivative of swish activation

Arguments

Type IntentOptional Attributes Name
class(array_type), intent(inout) :: this
type(array_type), intent(in) :: upstream_grad

Return Value type(array_type)

function softmax_reverse_array(softmax, gradient, dim) result(output)

Softmax function for reverse mode autodiff

Arguments

Type IntentOptional Attributes Name
class(array_type), intent(in), target :: softmax
class(array_type), intent(in), target :: gradient
integer, intent(in) :: dim

Return Value type(array_type), pointer


Subroutines

pure subroutine get_partial_add_bias_val(this, upstream_grad, output)

Arguments

Type IntentOptional Attributes Name
class(array_type), intent(in) :: this
real(kind=real32), intent(in), dimension(:,:) :: upstream_grad
real(kind=real32), intent(out), dimension(:,:) :: output

pure subroutine get_partial_add_val(this, upstream_grad, output)

Get partial derivative with respect to left operand

Arguments

Type IntentOptional Attributes Name
class(array_type), intent(in) :: this
real(kind=real32), intent(in), dimension(:,:) :: upstream_grad
real(kind=real32), intent(out), dimension(:,:) :: output

pure subroutine get_partial_piecewise_val(this, upstream_grad, output)

Get partial derivative of piecewise activation (in-place version)

Arguments

Type IntentOptional Attributes Name
class(array_type), intent(in) :: this
real(kind=real32), intent(in), dimension(:,:) :: upstream_grad
real(kind=real32), intent(out), dimension(:,:) :: output

pure subroutine get_partial_softmax_reverse_left_val(this, upstream_grad, output)

Get partial derivative of softmax reverse operation (in-place version)

Arguments

Type IntentOptional Attributes Name
class(array_type), intent(in) :: this
real(kind=real32), intent(in), dimension(:,:) :: upstream_grad
real(kind=real32), intent(out), dimension(:,:) :: output

pure subroutine get_partial_softmax_reverse_right_val(this, upstream_grad, output)

Get partial derivative of softmax reverse operation (in-place version)

Arguments

Type IntentOptional Attributes Name
class(array_type), intent(in) :: this
real(kind=real32), intent(in), dimension(:,:) :: upstream_grad
real(kind=real32), intent(out), dimension(:,:) :: output

pure subroutine get_partial_softmax_val(this, upstream_grad, output)

Get partial derivative of softmax activation (in-place version)

Arguments

Type IntentOptional Attributes Name
class(array_type), intent(in) :: this
real(kind=real32), intent(in), dimension(:,:) :: upstream_grad
real(kind=real32), intent(out), dimension(:,:) :: output

pure subroutine get_partial_softmax_val_sum(this, upstream_grad, output)

Get partial derivative of softmax activation (in-place version, summed over samples)

Arguments

Type IntentOptional Attributes Name
class(array_type), intent(in) :: this
real(kind=real32), intent(in), dimension(:,:) :: upstream_grad
real(kind=real32), intent(out), dimension(:) :: output

pure subroutine get_partial_swish_val(this, upstream_grad, output)

Get partial derivative of swish activation (in-place version)

Arguments

Type IntentOptional Attributes Name
class(array_type), intent(in) :: this
real(kind=real32), intent(in), dimension(:,:) :: upstream_grad
real(kind=real32), intent(out), dimension(:,:) :: output

Module Functions

module function add_array_ptr(a, idx1, idx2) result(c)

Add two autodiff arrays

Arguments

Type IntentOptional Attributes Name
type(array_ptr_type), intent(in), dimension(:) :: a
integer, intent(in) :: idx1
integer, intent(in) :: idx2

Return Value type(array_type), pointer

module function add_bias(input, bias, dim, dim_act_on_shape) result(output)

Add bias to input array along specified dimension

Arguments

Type IntentOptional Attributes Name
class(array_type), intent(in), target :: input
class(array_type), intent(in), target :: bias
integer, intent(in) :: dim
logical, intent(in), optional :: dim_act_on_shape

Return Value type(array_type), pointer

module function concat_array_ptr(a, idx1, idx2, dim) result(c)

Concatenate two autodiff arrays along a specified dimension

Arguments

Type IntentOptional Attributes Name
type(array_ptr_type), intent(in), dimension(:) :: a
integer, intent(in) :: idx1
integer, intent(in) :: idx2
integer, intent(in) :: dim

Return Value type(array_type), pointer

module function piecewise_array(input, gradient, limit) result(output)

Apply piecewise activation function to input array

Arguments

Type IntentOptional Attributes Name
class(array_type), intent(in), target :: input
real(kind=real32), intent(in) :: gradient
real(kind=real32), intent(in) :: limit

Return Value type(array_type), pointer

module function softmax_array(input, dim) result(output)

Arguments

Type IntentOptional Attributes Name
class(array_type), intent(in), target :: input
integer, intent(in) :: dim

Return Value type(array_type), pointer

module function swish_array(input, beta) result(output)

Swish activation function

Arguments

Type IntentOptional Attributes Name
class(array_type), intent(in), target :: input
real(kind=real32), intent(in) :: beta

Return Value type(array_type), pointer