35 TensorShape get_output_shape(
const ITensorInfo *
input,
bool has_bias)
47 Status
validate_arguments(
const ITensorInfo *input,
const ITensorInfo *biases,
const ITensorInfo *output)
60 ARM_COMPUTE_RETURN_ERROR_ON((input->num_dimensions() == 5) && (biases->dimension(0) != input->tensor_shape()[3] || biases->dimension(1) != input->tensor_shape()[4]));
64 if(output->total_size() != 0)
74 std::pair<Status, Window> validate_and_configure_window(ITensorInfo *input, ITensorInfo *output)
77 window.set(
Window::DimX, Window::Dimension(0, input->dimension(0), input->dimension(0)));
78 window.set(
Window::DimY, Window::Dimension(0, input->dimension(1), input->dimension(1)));
79 window.set(
Window::DimZ, Window::Dimension(0, input->dimension(2), input->dimension(2)));
82 output->set_valid_region(ValidRegion(Coordinates(), output->tensor_shape()));
84 return std::make_pair(Status{}, window);
89 : _input(nullptr), _bias(nullptr), _output(nullptr)
102 (bias !=
nullptr) ? bias->
info() :
nullptr,
110 auto win_config = validate_and_configure_window(input->
info(), output->
info());
112 INEKernel::configure(win_config.second);
129 const unsigned int kernel_size_x = _input->
info()->
dimension(0);
130 const unsigned int kernel_size_y = _input->
info()->
dimension(1);
131 const unsigned int kernel_depth = _input->
info()->
dimension(2);
142 const int kernel_idx =
id[3];
143 const int kernel_idz =
id[4];
146 const uint8_t *tmp_input_ptr = in.
ptr();
148 const uint8_t *curr_input_row_ptr = tmp_input_ptr;
149 const uint8_t *curr_input_depth_ptr = tmp_input_ptr;
152 for(
unsigned int d = 0; d < kernel_depth; ++d)
154 for(
unsigned int j = 0; j < kernel_size_y; ++j)
156 for(
unsigned int i = 0; i < kernel_size_x; ++i)
159 tmp_input_ptr += input_stride_x;
160 tmp_output_ptr += output_stride_y;
163 tmp_input_ptr = curr_input_row_ptr;
166 curr_input_row_ptr = curr_input_depth_ptr;
167 tmp_input_ptr = curr_input_depth_ptr;
void configure(const ITensor *input, const ITensor *bias, ITensor *output)
Set the input and output of the kernel.
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.
uint8_t * ptr_to_element(const Coordinates &id) const
Return a pointer to the element at the passed coordinates.
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_QUANTIZATION_INFO(...)
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Store the tensor's metadata.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
void run(const Window &window, const ThreadInfo &info) override
Execute the kernel on the passed window.
const size_t input_stride_y
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
Interface for Neon tensor.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DIMENSIONS(...)
Copyright (c) 2017-2021 Arm Limited.
static Status validate(const ITensorInfo *input, const ITensorInfo *biases, const ITensorInfo *output)
Static function to check if given info will lead to a valid configuration of NEWeightsReshapeKernel.
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
T x() const
Alias to access the size of the first dimension.
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
T z() const
Alias to access the size of the third 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 std::unique_ptr< T > clone() const =0
Provide a clone of the current object of class T.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
constexpr uint8_t * ptr() const
Return a pointer to the current pixel.
virtual size_t element_size() const =0
Element size in bytes calculated as data_size() * num_channels()
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
bool is_data_type_quantized_asymmetric(DataType dt)
Check if a given data type is of asymmetric quantized type.
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
Information about executing thread and CPU.
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(...)
Status validate_arguments(const ITensorInfo *input, const ITensorInfo *bias, const ITensorInfo *output, const GEMMLowpOutputStageInfo *output_stage)
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
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...
const size_t input_stride_z
T y() const
Alias to access the size of the second dimension.
virtual const Strides & strides_in_bytes() const =0
The strides in bytes for accessing each dimension of the tensor.
Iterator updated by execute_window_loop for each window element.
NEWeightsReshapeKernel()
Constructor.
Describe a multidimensional execution window.
void collapse(size_t n, size_t first=0)
Collapse the first n dimensions.
TensorShape & set(size_t dimension, size_t value, bool apply_dim_correction=true, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)