diff options
author | Michalis Spyrou <michalis.spyrou@arm.com> | 2020-06-18 10:14:57 +0100 |
---|---|---|
committer | Michalis Spyrou <michalis.spyrou@arm.com> | 2020-06-19 14:35:22 +0000 |
commit | ce0c67559cf03965acc8f212263a9f53205a0a3f (patch) | |
tree | c37105c72538108c46e5964cf49d15acd2d85980 /src/runtime/NEON/functions/NEPReluLayer.cpp | |
parent | 3be0b8c8d4e90bd264e9575dc2b6994ce8e14d50 (diff) | |
download | ComputeLibrary-ce0c67559cf03965acc8f212263a9f53205a0a3f.tar.gz |
COMPMID-3377: Async support to NEElementwiseUnaryLayerKernel kernels/functions
Signed-off-by: Michalis Spyrou <michalis.spyrou@arm.com>
Change-Id: I208287b44ece051e95f891d43a691cb0ac6e56c5
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3419
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/runtime/NEON/functions/NEPReluLayer.cpp')
-rw-r--r-- | src/runtime/NEON/functions/NEPReluLayer.cpp | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/src/runtime/NEON/functions/NEPReluLayer.cpp b/src/runtime/NEON/functions/NEPReluLayer.cpp index 02dfc6f137..1dd01fc162 100644 --- a/src/runtime/NEON/functions/NEPReluLayer.cpp +++ b/src/runtime/NEON/functions/NEPReluLayer.cpp @@ -29,7 +29,9 @@ namespace arm_compute { -void NEPReluLayer::configure(const ITensor *input, const ITensor *alpha, ITensor *output) +namespace experimental +{ +void NEPReluLayer::configure(const ITensorInfo *input, const ITensorInfo *alpha, ITensorInfo *output) { auto k = arm_compute::support::cpp14::make_unique<NEArithmeticOperationKernel>(); k->configure(ArithmeticOperation::PRELU, input, alpha, output); @@ -40,4 +42,47 @@ Status NEPReluLayer::validate(const ITensorInfo *input, const ITensorInfo *alpha { return NEArithmeticOperationKernel::validate(ArithmeticOperation::PRELU, input, alpha, output); } + +MemoryRequirements NEPReluLayer::workspace() const +{ + return MemoryRequirements{}; +} +} // nsamespace experimental + +struct NEPReluLayer::Impl +{ + const ITensor *src_0{ nullptr }; + const ITensor *src_1{ nullptr }; + ITensor *dst{ nullptr }; + std::unique_ptr<experimental::NEPReluLayer> op{ nullptr }; +}; + +NEPReluLayer::NEPReluLayer() + : _impl(support::cpp14::make_unique<Impl>()) +{ +} +NEPReluLayer::NEPReluLayer(NEPReluLayer &&) = default; +NEPReluLayer &NEPReluLayer::operator=(NEPReluLayer &&) = default; +NEPReluLayer::~NEPReluLayer() = default; + +void NEPReluLayer::configure(const ITensor *input, const ITensor *alpha, ITensor *output) +{ + _impl->src_0 = input; + _impl->src_1 = alpha; + _impl->dst = output; + _impl->op = arm_compute::support::cpp14::make_unique<experimental::NEPReluLayer>(); + _impl->op->configure(input->info(), alpha->info(), output->info()); +} + +void NEPReluLayer::run() +{ + const InputTensorMap src{ { TensorType::ACL_SRC_0, _impl->src_0 }, { TensorType::ACL_SRC_1, _impl->src_1 } }; + const OutputTensorMap dst{ { TensorType::ACL_DST, _impl->dst } }; + _impl->op->run(src, dst, {}); +} + +Status NEPReluLayer::validate(const ITensorInfo *input, const ITensorInfo *alpha, const ITensorInfo *output) +{ + return experimental::NEPReluLayer::validate(input, alpha, output); +} } // namespace arm_compute |