aboutsummaryrefslogtreecommitdiff
path: root/src/core/NEON/kernels/NEActivationLayerKernel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/NEON/kernels/NEActivationLayerKernel.cpp')
-rw-r--r--src/core/NEON/kernels/NEActivationLayerKernel.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/core/NEON/kernels/NEActivationLayerKernel.cpp b/src/core/NEON/kernels/NEActivationLayerKernel.cpp
index 6f722e0457..c338ef09c7 100644
--- a/src/core/NEON/kernels/NEActivationLayerKernel.cpp
+++ b/src/core/NEON/kernels/NEActivationLayerKernel.cpp
@@ -109,7 +109,7 @@ std::pair<Status, Window> validate_and_configure_window(ITensorInfo *input, ITen
} // namespace
NEActivationLayerKernel::NEActivationLayerKernel()
- : _input(nullptr), _output(nullptr), _func(nullptr), _act_info(ActivationFunction::LOGISTIC)
+ : _input(nullptr), _output(nullptr), _func(nullptr), _act_info()
{
}
@@ -121,11 +121,18 @@ void NEActivationLayerKernel::configure(ITensor *input, ITensor *output, Activat
_act_info = activation_info;
_output = input;
+ // Out-of-place calculation
if(output != nullptr)
{
_output = output;
}
+ // Disabled activation, thus no operation needed
+ if(!activation_info.enabled())
+ {
+ _func = nullptr;
+ }
+
ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), (output != nullptr) ? output->info() : nullptr, activation_info));
// Activation functions : FP32
@@ -610,6 +617,12 @@ Status NEActivationLayerKernel::validate(const ITensorInfo *input, const ITensor
void NEActivationLayerKernel::run(const Window &window, const ThreadInfo &info)
{
+ // Early exit on disabled activation
+ if(!_act_info.enabled())
+ {
+ return;
+ }
+
ARM_COMPUTE_UNUSED(info);
ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this);
ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(IKernel::window(), window);