39 TensorShape get_output_shape(
const ITensorInfo *
src,
bool has_bias)
51 Status validate_arguments(
const ITensorInfo *src,
const ITensorInfo *biases,
const ITensorInfo *
dst)
64 ARM_COMPUTE_RETURN_ERROR_ON((src->num_dimensions() == 5) && (biases->dimension(0) != src->tensor_shape()[3] || biases->dimension(1) != src->tensor_shape()[4]));
68 if(dst->total_size() != 0)
96 ICpuKernel::configure(window);
115 const unsigned int kernel_size_x = src->
info()->
dimension(0);
116 const unsigned int kernel_size_y = src->info()->dimension(1);
117 const unsigned int kernel_depth = src->info()->dimension(2);
118 const unsigned int input_stride_x = src->info()->strides_in_bytes().x();
119 const unsigned int input_stride_y = src->info()->strides_in_bytes().y();
120 const unsigned int input_stride_z = src->info()->strides_in_bytes().z();
121 const unsigned int output_stride_y = dst->info()->strides_in_bytes().y();
128 const int kernel_idx =
id[3];
129 const int kernel_idz =
id[4];
132 const uint8_t *tmp_input_ptr = in.
ptr();
133 uint8_t *tmp_output_ptr = dst->ptr_to_element(
Coordinates(kernel_idx, 0, kernel_idz));
134 const uint8_t *curr_input_row_ptr = tmp_input_ptr;
135 const uint8_t *curr_input_depth_ptr = tmp_input_ptr;
138 for(
unsigned int d = 0; d < kernel_depth; ++d)
140 for(
unsigned int j = 0; j < kernel_size_y; ++j)
142 for(
unsigned int i = 0; i < kernel_size_x; ++i)
144 std::memcpy(tmp_output_ptr, tmp_input_ptr, src->info()->element_size());
145 tmp_input_ptr += input_stride_x;
146 tmp_output_ptr += output_stride_y;
149 tmp_input_ptr = curr_input_row_ptr;
152 curr_input_row_ptr = curr_input_depth_ptr;
153 tmp_input_ptr = curr_input_depth_ptr;
157 if(biases !=
nullptr)
159 std::memcpy(tmp_output_ptr, biases->ptr_to_element(
Coordinates(kernel_idx, kernel_idz)), src->info()->element_size());
166 return "CpuWeightsReshapeKernel";
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.
void configure(const ITensorInfo *src, const ITensorInfo *biases, ITensorInfo *dst)
Set the input and output of the kernel.
void run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) override
Execute the kernel on the passed window.
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(...)
const size_t input_stride_y
#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)
Describe one of the image's dimensions with a start, end and step.
const size_t input_stride_z
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DIMENSIONS(...)
SimpleTensor< float > src
Copyright (c) 2017-2021 Arm Limited.
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
const ITensor * get_const_tensor(int id) const
Get constant tensor of a given id.
static Status validate(const ITensorInfo *src, const ITensorInfo *biases, const ITensorInfo *dst)
Static function to check if given info will lead to a valid configuration.
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
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 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.
void set(size_t dimension, const Dimension &dim)
Set the values of a given dimension.
#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)
ITensor * get_tensor(int id)
Get tensor of a given id from the pac.
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(...)
#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...
Iterator updated by execute_window_loop for each window element.
const char * name() const override
Name of the kernel.
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)