forward_reshape Subroutine

private subroutine forward_reshape(this, input)

Forward propagation derived type handler

Type Bound

reshape_layer_type

Arguments

Type IntentOptional Attributes Name
class(reshape_layer_type), intent(inout) :: this

Instance of the reshape layer

class(array_type), intent(in), dimension(:,:) :: input

Input array


Source Code

  subroutine forward_reshape(this, input)
    !! Forward propagation derived type handler
    implicit none

    ! Arguments
    class(reshape_layer_type), intent(inout) :: this
    !! Instance of the reshape layer
    class(array_type), dimension(:,:), intent(in) :: input
    !! Input array

    type(array_type), pointer :: ptr => null()

    ! Reshape input
    !---------------------------------------------------------------------------
    call this%output(1,1)%zero_grad()
    ptr => reshape(input(1,1), this%output_shape)
    call this%output(1,1)%assign_and_deallocate_source(ptr)
    this%output(1,1)%is_temporary = .false.

  end subroutine forward_reshape