Divide autodiff array by a real array
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(array_type), | intent(in), | target | :: | a | ||
| real(kind=real32), | intent(in), | dimension(:) | :: | b |
module function divide_real1d(a, b) result(c) !! Divide autodiff array by a real array implicit none class(array_type), intent(in), target :: a real(real32), dimension(:), intent(in) :: b type(array_type), pointer :: c type(array_type), pointer :: b_array integer :: i, s c => a%create_result() do concurrent(s = 1:size(a%val,2), i = 1:size(a%val,1)) c%val(i,s) = a%val(i,s) / b(s) end do c%get_partial_left => get_partial_divide_left c%get_partial_left_val => get_partial_divide_left_val if(a%requires_grad)then c%requires_grad = .true. c%is_forward = a%is_forward c%operation = 'divide_real1d' c%left_operand => a c%owns_left_operand = a%is_temporary end if allocate(b_array) b_array%is_sample_dependent = .false. b_array%requires_grad = .false. call b_array%allocate(array_shape=[1, size(b)]) b_array%val(1,:) = b c%right_operand => b_array c%owns_right_operand = .true. end function divide_real1d