aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/core
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2018-03-13 10:29:13 +0000
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:49:16 +0000
commit6727f12b7d5e29a98e42e846ca012a56e930fd33 (patch)
treeba8c14af3a1dc01fba74f6090c5ae9314194bdb5 /arm_compute/core
parent7e1944d7073a0e2eccaf2c1dce5daa197e6dedf5 (diff)
downloadComputeLibrary-6727f12b7d5e29a98e42e846ca012a56e930fd33.tar.gz
Revert "COMPMID-959: Fix valid region for Scale by always setting full shape"
This reverts commit 77fdc0420dfd3c5009370650f963748a73f0db58. Change-Id: I1440f56f29637821e20ad2edf1055196bb69a0e2 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/124290 Tested-by: Jenkins <bsgcomp@arm.com> Reviewed-by: Isabella Gottardi <isabella.gottardi@arm.com>
Diffstat (limited to 'arm_compute/core')
-rw-r--r--arm_compute/core/Helpers.h15
-rw-r--r--arm_compute/core/Helpers.inl33
-rw-r--r--arm_compute/core/utils/misc/utility.h8
3 files changed, 40 insertions, 16 deletions
diff --git a/arm_compute/core/Helpers.h b/arm_compute/core/Helpers.h
index c412d21447..24ba521d60 100644
--- a/arm_compute/core/Helpers.h
+++ b/arm_compute/core/Helpers.h
@@ -620,16 +620,15 @@ bool set_quantization_info_if_empty(ITensorInfo &info, QuantizationInfo quantiza
/** Helper function to calculate the Valid Region for Scale.
*
- * @param[in] src_info Input tensor info used to check.
- * @param[in] dst_shape Shape of the output.
- * @param[in] interpolate_policy Interpolation policy.
- * @param[in] sampling_policy Sampling policy.
- * @param[in] border_undefined True if the border is undefined.
+ * @param[in] src_info Input tensor info used to check.
+ * @param[in] dst_shape Shape of the output.
+ * @param[in] policy Interpolation policy.
+ * @param[in] border_size Size of the border.
+ * @param[in] border_undefined True if the border is undefined.
*
- * @return The corresponding valid region
+ * @return The corrispondent valid region
*/
-ValidRegion calculate_valid_region_scale(const ITensorInfo &src_info, const TensorShape &dst_shape,
- InterpolationPolicy interpolate_policy, SamplingPolicy sampling_policy, bool border_undefined);
+ValidRegion calculate_valid_region_scale(const ITensorInfo &src_info, const TensorShape &dst_shape, InterpolationPolicy policy, BorderSize border_size, bool border_undefined);
/** Convert a linear index into n-dimensional coordinates.
*
diff --git a/arm_compute/core/Helpers.inl b/arm_compute/core/Helpers.inl
index b359811328..3db8369f08 100644
--- a/arm_compute/core/Helpers.inl
+++ b/arm_compute/core/Helpers.inl
@@ -300,6 +300,39 @@ inline bool set_quantization_info_if_empty(ITensorInfo &info, QuantizationInfo q
return false;
}
+inline ValidRegion calculate_valid_region_scale(const ITensorInfo &src_info, const TensorShape &dst_shape, InterpolationPolicy policy, BorderSize border_size, bool border_undefined)
+{
+ const auto wr = static_cast<float>(dst_shape[0]) / static_cast<float>(src_info.tensor_shape()[0]);
+ const auto hr = static_cast<float>(dst_shape[1]) / static_cast<float>(src_info.tensor_shape()[1]);
+
+ ValidRegion valid_region{ Coordinates(), dst_shape, src_info.tensor_shape().num_dimensions() };
+
+ Coordinates &anchor = valid_region.anchor;
+ TensorShape &shape = valid_region.shape;
+
+ anchor.set(0, (policy == InterpolationPolicy::BILINEAR
+ && border_undefined) ?
+ ((static_cast<int>(src_info.valid_region().anchor[0]) + border_size.left + 0.5f) * wr - 0.5f) :
+ ((static_cast<int>(src_info.valid_region().anchor[0]) + 0.5f) * wr - 0.5f));
+ anchor.set(1, (policy == InterpolationPolicy::BILINEAR
+ && border_undefined) ?
+ ((static_cast<int>(src_info.valid_region().anchor[1]) + border_size.top + 0.5f) * hr - 0.5f) :
+ ((static_cast<int>(src_info.valid_region().anchor[1]) + 0.5f) * hr - 0.5f));
+ float shape_out_x = (policy == InterpolationPolicy::BILINEAR
+ && border_undefined) ?
+ ((static_cast<int>(src_info.valid_region().anchor[0]) + static_cast<int>(src_info.valid_region().shape[0]) - 1) - 1 + 0.5f) * wr - 0.5f :
+ ((static_cast<int>(src_info.valid_region().anchor[0]) + static_cast<int>(src_info.valid_region().shape[0])) + 0.5f) * wr - 0.5f;
+ float shape_out_y = (policy == InterpolationPolicy::BILINEAR
+ && border_undefined) ?
+ ((static_cast<int>(src_info.valid_region().anchor[1]) + static_cast<int>(src_info.valid_region().shape[1]) - 1) - 1 + 0.5f) * hr - 0.5f :
+ ((static_cast<int>(src_info.valid_region().anchor[1]) + static_cast<int>(src_info.valid_region().shape[1])) + 0.5f) * hr - 0.5f;
+
+ shape.set(0, shape_out_x - anchor[0]);
+ shape.set(1, shape_out_y - anchor[1]);
+
+ return valid_region;
+}
+
inline Coordinates index2coords(const TensorShape &shape, int index)
{
int num_elements = shape.total_size();
diff --git a/arm_compute/core/utils/misc/utility.h b/arm_compute/core/utils/misc/utility.h
index d6f555b5f3..8ba92310da 100644
--- a/arm_compute/core/utils/misc/utility.h
+++ b/arm_compute/core/utils/misc/utility.h
@@ -165,14 +165,6 @@ std::vector<size_t> sort_indices(const std::vector<T> &v)
return idx;
}
-/** Ignores the given arguments
- *
- * @tparam T Arguments types
- */
-template <typename... T>
-inline void ignore_unused(T &&...)
-{
-}
} // namespace utility
} // namespace arm_compute
#endif /* __ARM_COMPUTE_MISC_UTILITY_H__ */