diffstruc__operations_hyp Module

This module contains hyperbolic operations for the diffstruc library.


Uses


Interfaces

public interface tanh

  • private function tanh_array(a) result(c)

    Hyperbolic tangent function for autodiff arrays

    Arguments

    Type IntentOptional Attributes Name
    class(array_type), intent(in), target :: a

    Return Value type(array_type), pointer


Functions

private function get_partial_tanh(this, upstream_grad) result(output)

Arguments

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

Return Value type(array_type)

private function get_partial_tanh_reverse(this, upstream_grad) result(output)

Arguments

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

Return Value type(array_type)

private function tanh_array(a) result(c)

Hyperbolic tangent function for autodiff arrays

Arguments

Type IntentOptional Attributes Name
class(array_type), intent(in), target :: a

Return Value type(array_type), pointer

private function tanh_reverse_array(a) result(c)

Reverse mode for tanh function

Arguments

Type IntentOptional Attributes Name
class(array_type), intent(in), target :: a

Return Value type(array_type), pointer


Subroutines

private pure subroutine get_partial_tanh_reverse_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

private pure subroutine get_partial_tanh_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

private pure subroutine get_partial_tanh_val_sum(this, upstream_grad, output)

Fused partial+sum for tanh: output(:,1) = sum_s(upstream * (1 - val^2))

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