24 #ifndef ARM_COMPUTE_TEST_DERIVATIVE_FIXTURE 25 #define ARM_COMPUTE_TEST_DERIVATIVE_FIXTURE 42 template <
typename TensorType,
typename AccessorType,
typename FunctionType,
typename T,
typename U>
46 template <
typename...>
50 std::mt19937 gen(
library->seed());
51 std::uniform_int_distribution<uint8_t> int_dist(0, 255);
52 const uint8_t constant_border_value = int_dist(gen);
55 _target = compute_target(shape, border_mode, format, constant_border_value, gradient_dimension);
56 _reference = compute_reference(shape, border_mode, format, constant_border_value, gradient_dimension);
63 library->fill_tensor_uniform(tensor, 0);
67 void fill_zero(
V &&tensor)
69 library->fill_tensor_uniform(tensor, 0, static_cast<U>(0), static_cast<U>(0));
79 src.info()->set_format(format);
85 switch(gradient_dimension)
87 case GradientDimension::GRAD_X:
88 derivative.configure(&src, &dst_x,
nullptr, border_mode, constant_border_value);
90 case GradientDimension::GRAD_Y:
91 derivative.configure(&src,
nullptr, &dst_y, border_mode, constant_border_value);
94 derivative.configure(&src, &dst_x, &dst_y, border_mode, constant_border_value);
105 src.allocator()->allocate();
106 dst_x.allocator()->allocate();
107 dst_y.allocator()->allocate();
114 fill(AccessorType(src));
115 fill_zero(AccessorType(dst_x));
116 fill_zero(AccessorType(dst_y));
121 return std::make_pair(std::move(dst_x), std::move(dst_y));
132 return reference::derivative<U>(
src,
border_mode, constant_border_value, gradient_dimension);
136 std::pair<TensorType, TensorType> _target{};
BorderMode
Methods available to handle borders.
#define ARM_COMPUTE_ERROR(...)
Print the given message then throw an std::runtime_error.
This file contains all available output stages for GEMMLowp on OpenCL.
std::unique_ptr< AssetsLibrary > library
Format
Image colour formats.
void setup(TensorShape shape, BorderMode border_mode, Format format, GradientDimension gradient_dimension)
1 channel, 1 S16 per channel
DataType data_type_from_format(Format format)
Return the data type used by a given single-planar pixel format.
x and y gradient dimension
ARM_COMPUTE_EXPECT(src.info() ->is_resizable(), framework::LogLevel::ERRORS)
Borders are left undefined.
__kernel void derivative(__global uchar *src_ptr, uint src_stride_x, uint src_step_x, uint src_stride_y, uint src_step_y, uint src_offset_first_element_in_bytes, __global uchar *dst_gx_ptr, uint dst_gx_stride_x, uint dst_gx_step_x, uint dst_gx_stride_y, uint dst_gx_step_y, uint dst_gx_offset_first_element_in_bytes, __global uchar *dst_gy_ptr, uint dst_gy_stride_x, uint dst_gy_step_x, uint dst_gy_stride_y, uint dst_gy_step_y, uint dst_gy_offset_first_element_in_bytes)
This OpenCL kernel that computes the first-order derivative.
GradientDimension
Gradient dimension type.
convolution configure & src