24.02.1
|
Go to the documentation of this file.
40 TensorShape get_output_shape(
const ITensorInfo *
src,
bool has_bias)
58 if (biases !=
nullptr)
66 biases->dimension(1) !=
src->tensor_shape()[4]));
70 if (
dst->total_size() != 0)
73 get_output_shape(
src, biases !=
nullptr));
97 ICpuKernel::configure(
window);
116 const unsigned int kernel_size_x =
src->info()->dimension(0);
117 const unsigned int kernel_size_y =
src->info()->dimension(1);
118 const unsigned int kernel_depth =
src->info()->dimension(2);
119 const unsigned int input_stride_x =
src->info()->strides_in_bytes().x();
120 const unsigned int input_stride_y =
src->info()->strides_in_bytes().y();
121 const unsigned int input_stride_z =
src->info()->strides_in_bytes().z();
122 const unsigned int output_stride_y =
dst->info()->strides_in_bytes().y();
131 const int kernel_idx =
id[3];
132 const int kernel_idz =
id[4];
135 const uint8_t *tmp_input_ptr = in.
ptr();
136 uint8_t *tmp_output_ptr =
dst->ptr_to_element(
Coordinates(kernel_idx, 0, kernel_idz));
137 const uint8_t *curr_input_row_ptr = tmp_input_ptr;
138 const uint8_t *curr_input_depth_ptr = tmp_input_ptr;
141 for (
unsigned int d = 0; d < kernel_depth; ++d)
143 for (
unsigned int j = 0; j < kernel_size_y; ++j)
145 for (
unsigned int i = 0; i < kernel_size_x; ++i)
147 std::memcpy(tmp_output_ptr, tmp_input_ptr,
src->info()->element_size());
148 tmp_input_ptr += input_stride_x;
149 tmp_output_ptr += output_stride_y;
151 curr_input_row_ptr += input_stride_y;
152 tmp_input_ptr = curr_input_row_ptr;
154 curr_input_depth_ptr += input_stride_z;
155 curr_input_row_ptr = curr_input_depth_ptr;
156 tmp_input_ptr = curr_input_depth_ptr;
160 if (biases !=
nullptr)
162 std::memcpy(tmp_output_ptr, biases->ptr_to_element(
Coordinates(kernel_idx, kernel_idz)),
163 src->info()->element_size());
170 return "CpuWeightsReshapeKernel";
Class to describe a number of elements in each dimension.
SimpleTensor< float > src
void run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) override
Execute the kernel on the passed window.
Window calculate_max_window(const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
Status validate_arguments(const ITensorInfo *src, const ITensorInfo *weights, const ITensorInfo *dst, const PadStrideInfo &conv_info)
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
ITensor * get_tensor(int id)
Get tensor of a given id from the pac.
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.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(...)
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
constexpr uint8_t * ptr() const
Return a pointer to the current pixel.
const ITensor * get_const_tensor(int id) const
Get constant tensor of a given id.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
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.
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
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...
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Describe one of the image's dimensions with a start, end and step.
void set(size_t dimension, const Dimension &dim)
Set the values of a given dimension.
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
void configure(const ITensorInfo *src, const ITensorInfo *biases, ITensorInfo *dst)
Set the input and output of the kernel.
const Window & window() const
The maximum window the kernel can be executed on.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_QUANTIZATION_INFO(...)
Information about executing thread and CPU.
Describe a multidimensional execution window.
Copyright (c) 2017-2024 Arm Limited.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DIMENSIONS(...)
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
bool is_data_type_quantized_asymmetric(DataType dt)
Check if a given data type is of asymmetric quantized type.
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
Store the tensor's metadata.
const char * name() const override
Name of the kernel.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
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.
@ UNKNOWN
Unknown data type.
void collapse(size_t n, size_t first=0)
Collapse the first n dimensions.