Find maximum value between two autodiff arrays
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(array_type), | intent(in), | target | :: | a | ||
| class(array_type), | intent(in), | target | :: | b |
function max_array(a, b) result(c) !! Find maximum value between two autodiff arrays implicit none class(array_type), intent(in), target :: a, b type(array_type), pointer :: c c => a%create_result() c%val = max(a%val, b%val) c%get_partial_left => get_partial_max_left c%get_partial_right => get_partial_max_right c%get_partial_left_val => get_partial_max_left_val c%get_partial_right_val => get_partial_max_right_val if(a%requires_grad .or. b%requires_grad) then c%requires_grad = .true. c%is_forward = a%is_forward .or. b%is_forward c%operation = 'max' c%left_operand => a c%right_operand => b c%owns_left_operand = a%is_temporary c%owns_right_operand = b%is_temporary end if end function max_array