Get partial derivative of swish activation
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(array_type), | intent(inout) | :: | this | |||
| type(array_type), | intent(in) | :: | upstream_grad |
function get_partial_swish(this, upstream_grad) result(output) !! Get partial derivative of swish activation implicit none class(array_type), intent(inout) :: this type(array_type), intent(in) :: upstream_grad type(array_type) :: output type(array_type), pointer :: ptr type(array_type), pointer :: exp_term exp_term => exp(this%right_operand%val(1,1) * this%left_operand) ptr => upstream_grad * exp_term * ( & this%right_operand%val(1,1) * this%left_operand + & exp_term + 1._real32 & ) / ( ( exp_term + 1._real32 )**2._real32 ) call output%assign_and_deallocate_source(ptr) end function get_partial_swish