diff options
author | Georgios Pinitas <georgios.pinitas@arm.com> | 2018-08-24 11:25:32 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:54:54 +0000 |
commit | c1a72451273ec019e3e74c4b53ea847afe8ddf7c (patch) | |
tree | b4bd62a7ccd22a2c60070d7fa23ceba794dcac5c /src/core/utils/helpers | |
parent | 6a8d3b6db13042a859972c33cf40cfeb6d7cfcda (diff) | |
download | ComputeLibrary-c1a72451273ec019e3e74c4b53ea847afe8ddf7c.tar.gz |
COMPMID-1332: Implement Slice for CL
Change-Id: I0dbc4fd7f640d31daa1970eb3da0e941cb771f2b
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/146145
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Giorgio Arena <giorgio.arena@arm.com>
Reviewed-by: Michalis Spyrou <michalis.spyrou@arm.com>
Diffstat (limited to 'src/core/utils/helpers')
-rw-r--r-- | src/core/utils/helpers/tensor_transform.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/core/utils/helpers/tensor_transform.cpp b/src/core/utils/helpers/tensor_transform.cpp index 5c83a8bdb5..a4bce5da5a 100644 --- a/src/core/utils/helpers/tensor_transform.cpp +++ b/src/core/utils/helpers/tensor_transform.cpp @@ -29,6 +29,30 @@ namespace helpers { namespace tensor_transform { +Coordinates slice_absolute_end_coords(TensorShape input_shape, Coordinates ends) +{ + // Create end mask + int32_t end_mask = 0; + for(unsigned int i = 0; i < ends.num_dimensions(); ++i) + { + if(ends[i] < 0) + { + end_mask |= 1 << i; + } + } + // Get unit strides + const BiStrides unit_strides = strided_slice_strides(input_shape, BiStrides()); + + return strided_slice_absolute_end_coords(input_shape, Coordinates(), ends, unit_strides, end_mask); +} + +TensorShape compute_slice_output_shape(TensorShape input_shape, Coordinates starts, Coordinates ends_abs) +{ + // Get unit strides + const BiStrides unit_strides = strided_slice_strides(input_shape, BiStrides()); + return compute_strided_slice_output_shape(input_shape, starts, ends_abs, unit_strides); +} + Coordinates strided_slice_absolute_start_coords(TensorShape input_shape, Coordinates starts, Coordinates strides, int32_t begin_mask) { Coordinates starts_abs; |