Skip to content

Commit

Permalink
Remove pure keyword from procedures
Browse files Browse the repository at this point in the history
`differentiable_activation_strategy` and
`trainable_engine%to_inference_engine` because they contain
logic that is not allowed in pure procedures.
  • Loading branch information
ktras committed Feb 1, 2024
1 parent d64a4d3 commit 1c5bb88
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/inference_engine/trainable_engine_m.f90
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ elemental module function num_layers(self) result(n_layers)
integer n_layers
end function

pure module function to_inference_engine(self) result(inference_engine)
module function to_inference_engine(self) result(inference_engine)
implicit none
class(trainable_engine_t), intent(in) :: self
type(inference_engine_t) :: inference_engine
Expand Down
3 changes: 3 additions & 0 deletions src/inference_engine/trainable_engine_s.f90
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@
end procedure

module procedure to_inference_engine
! assignment-stmt disallows the procedure from being pure because it might
! deallocate polymorphic allocatable subcomponent `activation_strategy_`
! TODO: consider how this affects design
inference_engine = inference_engine_t(metadata = self%metadata_, weights = self%w, biases = self%b, nodes = self%n)
end procedure

Expand Down
2 changes: 1 addition & 1 deletion src/inference_engine/training_configuration_m.f90
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ elemental module function learning_rate(self) result(rate)
real(rkind) rate
end function

pure module function differentiable_activation_strategy(self) result(strategy)
module function differentiable_activation_strategy(self) result(strategy)
implicit none
class(training_configuration_t), intent(in) :: self
class(differentiable_activation_strategy_t), allocatable :: strategy
Expand Down

0 comments on commit 1c5bb88

Please sign in to comment.