Apply linear activation to 1D array
Computes: f = scale * x
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(linear_actv_type), | intent(in) | :: | this |
Linear activation type |
||
| type(array_type), | intent(in) | :: | val |
Input values |
Scaled output values
function apply_linear(this, val) result(output) !! Apply linear activation to 1D array !! !! Computes: f = scale * x implicit none ! Arguments class(linear_actv_type), intent(in) :: this !! Linear activation type type(array_type), intent(in) :: val !! Input values type(array_type), pointer :: output !! Scaled output values if(this%apply_scaling)then output => val * this%scale else output => val * 1._real32 ! multiplication by 1 to ensure new allocation end if end function apply_linear