From b4af2c6738614850aaca3754904f0e8e3b17f0b2 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Mon, 10 Dec 2018 18:45:35 +0000 Subject: COMPMID-1710: Fixes in StrideSlice calculations. Change-Id: I66eb922f1ff15142de278bf4439a61c979f98ba7 Reviewed-on: https://review.mlplatform.org/382 Reviewed-by: Matthew Bentham Tested-by: Arm Jenkins Reviewed-by: Pablo Marquez --- src/graph/nodes/SliceLayerNode.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/graph') diff --git a/src/graph/nodes/SliceLayerNode.cpp b/src/graph/nodes/SliceLayerNode.cpp index 3a29e4c9ad..bfc009d3eb 100644 --- a/src/graph/nodes/SliceLayerNode.cpp +++ b/src/graph/nodes/SliceLayerNode.cpp @@ -24,7 +24,7 @@ #include "arm_compute/graph/nodes/SliceLayerNode.h" #include "arm_compute/core/Utils.h" -#include "arm_compute/core/utils/helpers/tensor_transform.h" +#include "arm_compute/core/utils/misc/ShapeCalculator.h" #include "arm_compute/graph/Graph.h" #include "arm_compute/graph/INodeVisitor.h" @@ -52,16 +52,12 @@ Coordinates SliceLayerNode::ends() const TensorDescriptor SliceLayerNode::compute_output_descriptor(const TensorDescriptor &input_descriptor, const Coordinates &starts, const Coordinates &ends) { - // Get absolute end coordinates - const Coordinates ends_abs = arm_compute::helpers::tensor_transform::slice_absolute_end_coords(input_descriptor.shape, ends); + using namespace arm_compute::helpers::tensor_transform; - TensorDescriptor output_descriptor = input_descriptor; - for(unsigned int i = 0; i < starts.num_dimensions(); ++i) - { - output_descriptor.shape.set(i, ends_abs[i] - starts[i]); - } + TensorDescriptor output_desc = input_descriptor; + output_desc.shape = arm_compute::misc::shape_calculator::compute_slice_shape(input_descriptor.shape, starts, ends); - return output_descriptor; + return output_desc; } bool SliceLayerNode::forward_descriptors() -- cgit v1.2.1