constructor Function

private function constructor(this_size, next_size) result(layer)

Layer class constructor. this_size is the number of neurons in the layer. next_size is the number of neurons in the next layer, used to allocate the weights.

Arguments

Type IntentOptional AttributesName
integer(kind=ik), intent(in) :: this_size
integer(kind=ik), intent(in) :: next_size

Return Value type(layer_type)


Calls

proc~~constructor~~CallsGraph proc~constructor constructor interface~randn randn proc~constructor->interface~randn proc~randn1d randn1d interface~randn->proc~randn1d proc~randn2d randn2d interface~randn->proc~randn2d

Called by

proc~~constructor~~CalledByGraph proc~constructor constructor interface~layer_type layer_type interface~layer_type->proc~constructor

Contents

Source Code


Source Code

  type(layer_type) function constructor(this_size, next_size) result(layer)
    !! Layer class constructor. this_size is the number of neurons in the layer.
    !! next_size is the number of neurons in the next layer, used to allocate
    !! the weights.
    integer(ik), intent(in) :: this_size, next_size
    allocate(layer % a(this_size))
    allocate(layer % z(this_size))
    layer % a = 0
    layer % z = 0
    layer % w = randn(this_size, next_size) / this_size
    layer % b = randn(this_size)
  end function constructor