diff options
author | Michalis Spyrou <michalis.spyrou@arm.com> | 2019-07-09 14:21:06 +0100 |
---|---|---|
committer | Georgios Pinitas <georgios.pinitas@arm.com> | 2019-07-11 13:31:25 +0000 |
commit | d473386e4d5e0edcf55e13a2bf3c422a23fac0de (patch) | |
tree | 64c4132e8a46c809639d719e0426a7e6b9dd0371 /src/core/GLES_COMPUTE | |
parent | 9c9b70b9d30482d34f4f9c9dbc6479df163f96a1 (diff) | |
download | ComputeLibrary-d473386e4d5e0edcf55e13a2bf3c422a23fac0de.tar.gz |
COMPMID-2447: Align TFlite nearest neighbor NE/CL functions with ACL
Change-Id: Idd7b23247491d6e2e31d19b2a8aa522470ca174c
Signed-off-by: Michalis Spyrou <michalis.spyrou@arm.com>
Reviewed-on: https://review.mlplatform.org/c/1500
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Diffstat (limited to 'src/core/GLES_COMPUTE')
-rw-r--r-- | src/core/GLES_COMPUTE/cs_shaders/scale.cs | 9 | ||||
-rw-r--r-- | src/core/GLES_COMPUTE/kernels/GCScaleKernel.cpp | 10 |
2 files changed, 17 insertions, 2 deletions
diff --git a/src/core/GLES_COMPUTE/cs_shaders/scale.cs b/src/core/GLES_COMPUTE/cs_shaders/scale.cs index b72c3392aa..8a1d3e4c2d 100644 --- a/src/core/GLES_COMPUTE/cs_shaders/scale.cs +++ b/src/core/GLES_COMPUTE/cs_shaders/scale.cs @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -58,8 +58,15 @@ vec4[2] transform_nearest(vec2 coord, vec2 scale) vec4 in_x_coords = vec4(coord.x, 1.f + coord.x, 2.f + coord.x, 3.f + coord.x); vec4[2] t; +#if defined(SAMPLING_POLICY_CENTER) /* SAMPLING_POLICY_CENTER */ t[0] = (in_x_coords + (vec4(0.5f))) * scale.x; t[1] = vec4((coord.y + 0.5f) * scale.y); +#elif defined(SAMPLING_POLICY_TOP_LEFT) /* SAMPLING_POLICY_TOP_LEFT */ + t[0] = in_x_coords * scale.x; + t[1] = vec4(coord.y) * scale.y; +#else /* Unsupported sampling policy */ +#error Unsupported sampling policy +#endif return t; } diff --git a/src/core/GLES_COMPUTE/kernels/GCScaleKernel.cpp b/src/core/GLES_COMPUTE/kernels/GCScaleKernel.cpp index f87615a27c..1de0852da8 100644 --- a/src/core/GLES_COMPUTE/kernels/GCScaleKernel.cpp +++ b/src/core/GLES_COMPUTE/kernels/GCScaleKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -80,6 +80,14 @@ void GCScaleKernel::configure(const IGCTensor *input, IGCTensor *output, Interpo build_opts.emplace("#define DATA_TYPE_FP16"); build_opts.emplace("#define BORDER_SIZE " + support::cpp11::to_string(border.right)); + if(sampling_policy == SamplingPolicy::TOP_LEFT) + { + build_opts.emplace("#define SAMPLING_POLICY_TOP_LEFT"); + } + else + { + build_opts.emplace("#define SAMPLING_POLICY_CENTER"); + } // Configure kernel window unsigned int num_elems_processed_per_iteration = 4; |