calc_input_shape_add Function

private function calc_input_shape_add(this, input_shapes) result(input_shape)

Calculate input shape based on shapes of input layers

Type Bound

add_layer_type

Arguments

Type IntentOptional Attributes Name
class(add_layer_type), intent(in) :: this

Instance of the layer

integer, intent(in), dimension(:,:) :: input_shapes

Input shapes

Return Value integer, allocatable, dimension(:)

Calculated input shape


Source Code

  function calc_input_shape_add(this, input_shapes) result(input_shape)
    !! Calculate input shape based on shapes of input layers
    implicit none

    ! Arguments
    class(add_layer_type), intent(in) :: this
    !! Instance of the layer
    integer, dimension(:,:), intent(in) :: input_shapes
    !! Input shapes
    integer, allocatable, dimension(:) :: input_shape
    !! Calculated input shape

    ! Local variables
    integer :: i

    ! Check that all input shapes are the same
    do i = 2, size(input_shapes, 2), 1
       if(any(input_shapes(:,1).ne.input_shapes(:,i)))then
          call stop_program("All input shapes to add layer must be the same")
          return
       end if
    end do

    ! Set input shape
    input_shape = input_shapes(:,1)

  end function calc_input_shape_add