From 62e42307a67f7ae59557c00068afbdc9efcecadf Mon Sep 17 00:00:00 2001 From: Katherine Rasmussen Date: Thu, 1 Feb 2024 14:18:34 -0800 Subject: [PATCH] Add dummy argument to type bound procedure, `function_name` for types `activation_strategy_t`, `swish_t`, `relu_t`, `sigmoid_t` in order to keep the elemental keyword. --- src/inference_engine/activation_strategy_m.f90 | 7 ++++--- src/inference_engine/relu_m.f90 | 5 +++-- src/inference_engine/sigmoid_m.f90 | 5 +++-- src/inference_engine/step_m.f90 | 5 +++-- src/inference_engine/swish_m.f90 | 5 +++-- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/inference_engine/activation_strategy_m.f90 b/src/inference_engine/activation_strategy_m.f90 index 4c3fa5a88..65eb7f597 100644 --- a/src/inference_engine/activation_strategy_m.f90 +++ b/src/inference_engine/activation_strategy_m.f90 @@ -15,7 +15,7 @@ module activation_strategy_m type, abstract :: activation_strategy_t contains procedure(activation_i), nopass, deferred :: activation - procedure(function_name_i), nopass, deferred :: function_name + procedure(function_name_i), deferred :: function_name end type abstract interface @@ -27,9 +27,10 @@ elemental function activation_i(x) result(y) real(rkind) y end function - elemental function function_name_i() result(string) - import string_t + elemental function function_name_i(self) result(string) + import string_t, activation_strategy_t implicit none + class(activation_strategy_t), intent(in) :: self type(string_t) string end function diff --git a/src/inference_engine/relu_m.f90 b/src/inference_engine/relu_m.f90 index 0fae43e22..e2be3399c 100644 --- a/src/inference_engine/relu_m.f90 +++ b/src/inference_engine/relu_m.f90 @@ -13,7 +13,7 @@ module relu_m contains procedure, nopass :: activation procedure, nopass :: activation_derivative - procedure, nopass :: function_name + procedure :: function_name end type interface @@ -30,8 +30,9 @@ elemental module function activation_derivative(x) result(y) real(rkind) y end function - elemental module function function_name() result(string) + elemental module function function_name(self) result(string) implicit none + class(relu_t), intent(in) :: self type(string_t) string end function diff --git a/src/inference_engine/sigmoid_m.f90 b/src/inference_engine/sigmoid_m.f90 index 3f27b3c81..ba272fb9b 100644 --- a/src/inference_engine/sigmoid_m.f90 +++ b/src/inference_engine/sigmoid_m.f90 @@ -13,7 +13,7 @@ module sigmoid_m contains procedure, nopass :: activation procedure, nopass :: activation_derivative - procedure, nopass :: function_name + procedure :: function_name end type interface @@ -30,8 +30,9 @@ elemental module function activation_derivative(x) result(y) real(rkind) y end function - elemental module function function_name() result(string) + elemental module function function_name(self) result(string) implicit none + class(sigmoid_t), intent(in) :: self type(string_t) string end function diff --git a/src/inference_engine/step_m.f90 b/src/inference_engine/step_m.f90 index 297a99473..03baf6727 100644 --- a/src/inference_engine/step_m.f90 +++ b/src/inference_engine/step_m.f90 @@ -12,7 +12,7 @@ module step_m type, extends(activation_strategy_t) :: step_t contains procedure, nopass :: activation - procedure, nopass :: function_name + procedure :: function_name end type interface @@ -23,8 +23,9 @@ elemental module function activation(x) result(y) real(rkind) y end function - elemental module function function_name() result(string) + elemental module function function_name(self) result(string) implicit none + class(step_t), intent(in) :: self type(string_t) string end function diff --git a/src/inference_engine/swish_m.f90 b/src/inference_engine/swish_m.f90 index 64edac8dd..7f836c5f8 100644 --- a/src/inference_engine/swish_m.f90 +++ b/src/inference_engine/swish_m.f90 @@ -13,7 +13,7 @@ module swish_m contains procedure, nopass :: activation procedure, nopass :: activation_derivative - procedure, nopass :: function_name + procedure :: function_name end type interface @@ -30,8 +30,9 @@ elemental module function activation_derivative(x) result(y) real(rkind) y end function - elemental module function function_name() result(string) + elemental module function function_name(self) result(string) implicit none + class(swish_t), intent(in) :: self type(string_t) string end function