43 void range_function(ITensor *output,
float start,
float step,
const Window &window)
46 using ExactTagType =
typename wrapper::traits::neon_bitvector<T, wrapper::traits::BitWidth::W128>::tag_type;
48 const auto step_vec =
wrapper::vdup_n(static_cast<T>(step), ExactTagType{});
49 const auto start_vec =
wrapper::vdup_n(static_cast<T>(start), ExactTagType{});
52 const auto window_start_x =
static_cast<int>(window.x().start());
53 const auto window_end_x =
static_cast<int>(window.x().end());
54 const int window_step_x = 16 /
sizeof(T);
58 Iterator output_it(output, win);
62 int x = window_start_x;
63 const auto out_ptr =
reinterpret_cast<T *
>(output_it.ptr());
64 for(; x <= (window_end_x - window_step_x); x += window_step_x)
66 for(
int count = 0; count < window_step_x; ++count)
72 const auto res_vec =
wrapper::vmla(start_vec, id_vec, step_vec);
77 for(; x < window_end_x; ++x)
79 const auto res = start + x *
step;
87 Status validate_arguments(
const ITensorInfo &output,
const float start,
const float end,
const float step)
114 : _func(nullptr), _start(0), _end(1), _step(1), _output(nullptr)
137 _func = &range_function<uint8_t>;
140 _func = &range_function<uint16_t>;
143 _func = &range_function<uint32_t>;
146 _func = &range_function<int8_t>;
149 _func = &range_function<int16_t>;
152 _func = &range_function<int32_t>;
155 _func = &range_function<float>;
157 #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 159 _func = &range_function<float16_t>;
161 #endif // __ARM_FEATURE_FP16_VECTOR_ARITHMETIC 167 INEKernel::configure(win);
186 (*_func)(_output, _start, _step,
window);
Window calculate_max_window(const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
const Window & window() const
The maximum window the kernel can be executed on.
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
1 channel, 1 U8 per channel
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
virtual DataType data_type() const =0
Data type used for each element of the tensor.
void configure(ITensor *output, float start, float end, float step)
Initialize the kernel's output tensor, start, end and step of the sequence.
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.
Store the tensor's metadata.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
1 channel, 1 U16 per channel
Interface for CPU tensor.
Copyright (c) 2017-2021 Arm Limited.
1 channel, 1 F16 per channel
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
1 channel, 1 S32 per channel
static Status validate(const ITensorInfo *output, float start, float end, float step)
Static function to check if given info will lead to a valid configuration of NERangeKernel.
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
1 channel, 1 U32 per channel
bool check_value_range(T val, DataType dt, QuantizationInfo qinfo=QuantizationInfo())
Returns true if the value can be represented by the given data type.
Class to describe a number of elements in each dimension.
bool auto_init_if_empty(ITensorInfo &info, const TensorShape &shape, int num_channels, DataType data_type, QuantizationInfo quantization_info=QuantizationInfo())
Auto initialize the tensor info (shape, number of channels and data type) if the current assignment i...
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
void end(TokenStream &in, bool &valid)
uint8x8_t vsetlane(const uint8_t value, const uint8x8_t vector, const unsigned int lane)
virtual QuantizationInfo quantization_info() const =0
Get the quantization settings (scale and offset) of the tensor.
size_t num_of_elements_in_range(const float start, const float end, const float step)
Returns the number of elements required to go from start to end with the wanted step.
void run(const Window &window, const ThreadInfo &info) override
Execute the kernel on the passed window.
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
1 channel, 1 S16 per channel
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
Information about executing thread and CPU.
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
void vstore(uint8_t *ptr, uint8x8_t val)
#define ARM_COMPUTE_RETURN_ERROR_ON_MSG(cond, msg)
If the condition is true, an error is returned.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
uint8x8_t vdup_n(uint8_t value, traits::vector_64_tag)
void execute_window_loop(const Window &w, L &&lambda_function, Ts &&... iterators)
Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...
Includes all wrapper headers at once.
uint8x8_t vmla(const uint8x8_t &a, const uint8x8_t &b, const uint8x8_t &c)
Describe a multidimensional execution window.
NERangeKernel()
Default constructor.
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)