aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/NEON/functions/NEFlattenLayer.cpp
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2020-12-03 20:37:43 +0000
committerMichele Di Giorgio <michele.digiorgio@arm.com>2020-12-08 11:56:12 +0000
commite2696b1f9bb28b69beff99f54addd48f60823ddb (patch)
tree68705f1cdff45e4d0c174b6037f6e5ff696717d2 /src/runtime/NEON/functions/NEFlattenLayer.cpp
parent8c3c0e7b117723bc98b6acc85565ffa521b10c0d (diff)
downloadComputeLibrary-e2696b1f9bb28b69beff99f54addd48f60823ddb.tar.gz
Wrap Flatten layer over reshape
Flatten layer is lowered into a Reshape layer. Remove (CL/NE)FlatternLayerKernel. Partially Resolves: COMPMID-3996 Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com> Change-Id: Id9e2ddfe2e2dd793541badff3490c05e4c908f88 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4660 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Diffstat (limited to 'src/runtime/NEON/functions/NEFlattenLayer.cpp')
-rw-r--r--src/runtime/NEON/functions/NEFlattenLayer.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/runtime/NEON/functions/NEFlattenLayer.cpp b/src/runtime/NEON/functions/NEFlattenLayer.cpp
index 21e55665cd..c5aa162f0a 100644
--- a/src/runtime/NEON/functions/NEFlattenLayer.cpp
+++ b/src/runtime/NEON/functions/NEFlattenLayer.cpp
@@ -23,20 +23,32 @@
*/
#include "arm_compute/runtime/NEON/functions/NEFlattenLayer.h"
-#include "arm_compute/core/Size2D.h"
-#include "src/core/NEON/kernels/NEFlattenLayerKernel.h"
+#include "arm_compute/core/TensorInfo.h"
+#include "arm_compute/core/Validate.h"
+#include "arm_compute/core/utils/misc/ShapeCalculator.h"
+#include "src/core/helpers/AutoConfiguration.h"
namespace arm_compute
{
void NEFlattenLayer::configure(const ITensor *input, ITensor *output)
{
- auto k = std::make_unique<NEFlattenLayerKernel>();
- k->configure(input, output);
- _kernel = std::move(k);
+ ARM_COMPUTE_ERROR_ON_NULLPTR(input, output);
+ auto_init_if_empty(*output->info(), input->info()->clone()->set_tensor_shape(misc::shape_calculator::compute_flatten_shape(input->info())));
+ _reshape.configure(input, output);
}
Status NEFlattenLayer::validate(const ITensorInfo *input, const ITensorInfo *output)
{
- return NEFlattenLayerKernel::validate(input, output);
+ // Checks performed when output is configured
+ if(output->total_size() != 0)
+ {
+ const TensorInfo tensor_info_output = input->clone()->set_tensor_shape(misc::shape_calculator::compute_flatten_shape(input));
+ ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(output, &tensor_info_output);
+ }
+ return NEReshapeLayer::validate(input, output);
+}
+void NEFlattenLayer::run()
+{
+ _reshape.run();
}
} // namespace arm_compute