38 std::mt19937 gen(
library->seed());
39 std::bernoulli_distribution dist(0.5);
41 for(
int r = 0; r < rows; ++r)
43 for(
int c = 0;
c < cols; ++
c, ++v)
53 val = ((r == (rows / 2)) || (
c == (cols / 2))) ? 255 : 0;
56 val = (((r - rows / 2.0f + 0.5f) * (r - rows / 2.0f + 0.5f)) / ((rows / 2.0f) * (rows / 2.0f)) + ((
c - cols / 2.0f + 0.5f) * (
c - cols / 2.0f + 0.5f)) / ((cols / 2.0f) *
57 (cols / 2.0f))) <= 1.0f ? 255 : 0;
60 val = (dist(gen) ? 0 : 255);
72 std::uniform_int_distribution<uint8_t> distribution_u8(0, ((cols * rows) - 1));
73 mask[distribution_u8(gen)] = 255;
87 for(
const auto &
shape : input_shapes)
94 out_shape.set(0, max_x);
95 out_shape.set(1, max_y);
96 out_shape.set(2, depth);
109 return sum +
shape.x();
111 out_shape.set(0, width);
120 std::mt19937 gen(
library->seed());
121 std::uniform_real_distribution<float> threshold_dist(0.f, 0.001f);
122 std::uniform_real_distribution<float> sensitivity(0.04f, 0.15f);
123 std::uniform_real_distribution<float> euclidean_distance(0.f, 30.f);
124 std::uniform_int_distribution<uint8_t> int_dist(0, 255);
128 params.
min_dist = euclidean_distance(gen);
162 const int M = a.
shape()[1];
163 const int N = b.
shape()[0];
164 const int K = b.
shape()[1];
166 for(
int y = 0; y < M; ++y)
168 for(
int x = 0; x < N; ++x)
171 for(
int k = 0; k < K; ++k)
173 acc += a[y * K + k] * b[x + k * N];
176 out[x + y * N] = acc;
185 const int width = in.
shape()[0];
186 const int height = in.
shape()[1];
188 for(
int y = 0; y < height; ++y)
190 for(
int x = 0; x < width; ++x)
192 const float val = in[x + y * width];
194 out[x * height + y] = val;
199 template <
typename T>
204 const int w_tile = tile.
shape()[0];
205 const int h_tile = tile.
shape()[1];
208 std::fill(tile.
data() + 0, (tile.
data() + (w_tile * h_tile)),
static_cast<T
>(0));
213 if(coord[d] < 0 || coord[d] >= static_cast<int>(in.
shape()[d]))
226 auto in_ptr =
static_cast<const T *
>(in(start_coord));
227 auto roi_ptr =
static_cast<T *
>(tile.
data());
229 const int x_in_start =
std::max(0, coord[0]);
230 const int y_in_start =
std::max(0, coord[1]);
231 const int x_in_end =
std::min(static_cast<int>(in.
shape()[0]), coord[0] + w_tile);
232 const int y_in_end =
std::min(static_cast<int>(in.
shape()[1]), coord[1] + h_tile);
235 const int n = x_in_end - x_in_start;
238 const int x_tile_start = coord[0] > 0 ? 0 :
std::abs(coord[0]);
239 const int y_tile_start = coord[1] > 0 ? 0 :
std::abs(coord[1]);
242 in_ptr += x_in_start;
243 in_ptr += (y_in_start * in.
shape()[0]);
246 roi_ptr += x_tile_start;
247 roi_ptr += (y_tile_start * tile.
shape()[0]);
249 for(
int y = y_in_start; y < y_in_end; ++y)
254 in_ptr += in.
shape()[0];
255 roi_ptr += tile.
shape()[0];
#define ARM_COMPUTE_ERROR(...)
Print the given message then throw an std::runtime_error.
fixed_point< T > min(fixed_point< T > x, fixed_point< T > y)
float threshold
Threshold.
void fill_mask_from_pattern(uint8_t *mask, int cols, int rows, MatrixPattern pattern)
Fill mask with the corresponding given pattern.
Rounds to nearest value; half rounds away from zero.
void matrix_multiply(const SimpleTensor< float > &a, const SimpleTensor< float > &b, SimpleTensor< float > &out)
Matrix multiply between 2 float simple tensors.
DATA_TYPE sum(__global const DATA_TYPE *input)
Calculate sum of a vector.
1 channel, 1 F32 per channel
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
TensorShape shape() const override
Shape of the tensor.
SimpleTensor< T > copy(const SimpleTensor< T > &src, const TensorShape &output_shape)
TensorShape calculate_depth_concatenate_shape(const std::vector< TensorShape > &input_shapes)
Calculate output tensor shape give a vector of input tensor to concatenate.
This file contains all available output stages for GEMMLowp on OpenCL.
TensorShape calculate_width_concatenate_shape(const std::vector< TensorShape > &input_shapes)
Calculate output tensor shape give a vector of input tensor to concatenate.
uint8_t constant_border_value
Border value.
SimpleTensor< uint8_t > convert_to_asymmetric(const SimpleTensor< float > &src, const QuantizationInfo &quantization_info)
Convert float simple tensor into quantized using specified quantization information.
float sensitivity
Sensitivity.
const T * data() const
Constant pointer to the underlying buffer.
std::unique_ptr< AssetsLibrary > library
quantized, asymmetric fixed-point 8-bit number
float min_dist
Minimum distance.
DataLayout data_layout() const override
Data layout of the tensor.
HarrisCornersParameters harris_corners_parameters()
Generate parameters for Harris Corners algorithm.
Parameters of Harris Corners algorithm.
Simple tensor object that stores elements in a consecutive chunk of memory.
float dequantize(qasymm8_t value) const
Dequantizes a value using the scale/offset in this QuantizationInfo.
void get_tile(const SimpleTensor< T > &in, SimpleTensor< T > &tile, const Coordinates &coord)
Get a 2D tile from a tensor.
SimpleTensor< float > convert_from_asymmetric(const SimpleTensor< uint8_t > &src)
Convert quantized simple tensor into float using tensor quantization information. ...
int num_elements() const override
Number of elements of the tensor.
__kernel void accumulate(__global uchar *input_ptr, uint input_stride_x, uint input_step_x, uint input_stride_y, uint input_step_y, uint input_offset_first_element_in_bytes, __global uchar *accu_ptr, uint accu_stride_x, uint accu_step_x, uint accu_stride_y, uint accu_step_y, uint accu_offset_first_element_in_bytes)
This function accumulates an input image into output image.
fixed_point< T > max(fixed_point< T > x, fixed_point< T > y)
Quantization settings (used for QASYMM8 data type)
fixed_point< T > abs(fixed_point< T > x)
QuantizationInfo quantization_info() const override
Quantization info in case of asymmetric quantized type.
void transpose_matrix(const SimpleTensor< float > &in, SimpleTensor< float > &out)
Transpose matrix.
static constexpr size_t num_max_dimensions
Number of dimensions the tensor has.
MatrixPattern
Available matrix patterns.
Any other matrix pattern.
convolution configure & src