Initialise a piecewise activation function
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real32), | intent(in), | optional | :: | scale |
Optional scale factor for activation output |
|
| real(kind=real32), | intent(in), | optional | :: | gradient |
Optional gradient parameter for piecewise function |
|
| real(kind=real32), | intent(in), | optional | :: | limit |
Optional limit parameter for piecewise function -limit < x < limit |
|
| type(onnx_attribute_type), | intent(in), | optional, | dimension(:) | :: | attributes |
Optional array of ONNX attributes |
Piecewise activation type
function initialise(scale, gradient, limit, attributes) result(activation) !! Initialise a piecewise activation function implicit none ! Arguments real(real32), intent(in), optional :: scale !! Optional scale factor for activation output real(real32), intent(in), optional :: gradient !! Optional gradient parameter for piecewise function real(real32), intent(in), optional :: limit !! Optional limit parameter for piecewise function !! -limit < x < limit type(onnx_attribute_type), dimension(:), intent(in), optional :: attributes !! Optional array of ONNX attributes type(piecewise_actv_type) :: activation !! Piecewise activation type call activation%reset() if(present(scale)) activation%scale = scale if(abs(activation%scale-1._real32) .gt. 1.e-6_real32)then activation%apply_scaling = .true. end if if(present(gradient)) activation%gradient = gradient if(present(limit)) activation%limit = limit if(present(attributes))then call activation%apply_attributes(attributes) end if end function initialise