| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(array_type), | intent(inout) | :: | this | |||
| type(array_type), | intent(in) | :: | upstream_grad |
function get_partial_tanh(this, upstream_grad) result(output) implicit none class(array_type), intent(inout) :: this type(array_type), intent(in) :: upstream_grad type(array_type) :: output logical :: this_is_temporary_local type(array_type), pointer :: ptr this_is_temporary_local = this%is_temporary this%is_temporary = .false. ! derivative of tanh(x) is (1 - tanh(x)^2) ptr => upstream_grad * tanh_reverse_array(this) ! ptr => upstream_grad * (1._real32 - this ** 2._real32) this%is_temporary = this_is_temporary_local call output%assign_and_deallocate_source(ptr) end function get_partial_tanh