24.02.1
|
Go to the documentation of this file.
43 using namespace misc::shape_calculator;
45 static const std::vector<CpuPool3dKernel::Pooling3dKernel> available_kernels = {
46 {
"neon_qu8_ndhwc_poolMxNxD", [](
const DataTypeISASelectorData &data) {
return (data.dt ==
DataType::QASYMM8); },
48 {
"neon_qs8_ndhwc_poolMxNxD",
51 {
"neon_fp16_ndhwc_poolMxNxD",
52 [](
const DataTypeISASelectorData &data) {
return (data.dt ==
DataType::F16 && data.isa.fp16); },
54 {
"neon_fp32_ndhwc_poolMxNxD", [](
const DataTypeISASelectorData &data) {
return (data.dt ==
DataType::F32); },
67 "Exclude padding is unsupported for non-float types for Avg op");
74 const bool is_global_pooling = pool_info.is_global_pooling;
75 const unsigned int pool_size_x = is_global_pooling ?
src->dimension(
idx_width) : pool_info.pool_size.width;
76 const unsigned int pool_size_y = is_global_pooling ?
src->dimension(
idx_height) : pool_info.pool_size.height;
77 const unsigned int pool_size_z = is_global_pooling ?
src->dimension(idx_depth) : pool_info.pool_size.depth;
79 const unsigned int stride_x = pool_info.stride.x();
80 const unsigned int stride_y = pool_info.stride.y();
81 const unsigned int stride_z = pool_info.stride.z();
87 int output_height = 0;
91 "Pooling region that is entirely outside input tensor is unsupported");
93 std::tie(output_width, output_height, output_depth) =
95 src->tensor_shape()[idx_depth], pool_size_x, pool_size_y, pool_size_z, pool_info);
97 "Calculated output dimension size is invalid");
99 if (
dst->total_size() != 0)
143 _pool_info = pool_info;
144 _run_method = uk->ukernel;
145 _name = std::string(
"CpuPool3dKernel").append(
"/").append(uk->name);
149 ICpuKernel::configure(win);
176 return _name.c_str();
181 return available_kernels;
Class to describe a number of elements in each dimension.
TensorShape compute_pool3d_shape(const TensorShape &src, Pooling3dLayerInfo pool3d_info)
Calculate the output pool3d shape of a tensor.
SimpleTensor< float > src
bool is_pool_3d_region_entirely_outside_input(const Pooling3dLayerInfo &info)
Check if the 3d pool region is entirely outside the input tensor.
const char * name() const override
Name of the kernel.
Window calculate_max_window(const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
@ QASYMM8
quantized, asymmetric fixed-point 8-bit number unsigned
Status validate_arguments(const ITensorInfo *src, const ITensorInfo *weights, const ITensorInfo *dst, const PadStrideInfo &conv_info)
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(...)
#define REGISTER_QASYMM8_SIGNED_NEON(func_name)
static CPUInfo & get()
Access the KernelLibrary singleton.
Interface for CPU tensor.
ITensor * get_tensor(int id)
Get tensor of a given id from the pac.
#define REGISTER_FP16_NEON(func_name)
size_t width
Width of the 3D shape or object.
void neon_q8_pool3d(const ITensor *src0, ITensor *dst0, Pooling3dLayerInfo &, const Window &window)
void neon_q8_signed_pool3d(const ITensor *src0, ITensor *dst0, Pooling3dLayerInfo &, const Window &window)
#define REGISTER_QASYMM8_NEON(func_name)
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(...)
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
constexpr auto data_layout
static const std::vector< Pooling3dKernel > & get_available_kernels()
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
#define REGISTER_FP32_NEON(func_name)
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
size_t height
Height of the 3D shape or object.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
const ITensor * get_const_tensor(int id) const
Get constant tensor of a given id.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
size_t depth
Depth of the 3D shape or object.
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
#define ARM_COMPUTE_RETURN_ERROR_ON_CPU_F16_UNSUPPORTED(tensor)
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...
@ QASYMM8_SIGNED
quantized, asymmetric fixed-point 8-bit number signed
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
void neon_fp32_pool3d(const ITensor *src0, ITensor *dst0, Pooling3dLayerInfo &, const Window &window)
void configure(const ITensorInfo *src, ITensorInfo *dst, const Pooling3dLayerInfo &pool_info)
Set the src, dst tensor and pooling info.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_LAYOUT(...)
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
static const auto * get_implementation(const SelectorType &selector, KernelSelectionType selection_type=KernelSelectionType::Supported)
Micro-kernel selector.
Class for specifying the size of a 3D shape or object.
Pooling Layer Information struct.
const Window & window() const
The maximum window the kernel can be executed on.
static Status validate(const ITensorInfo *src, const ITensorInfo *dst, const Pooling3dLayerInfo &pool_info)
Static function to check if given info will lead to a valid configuration.
Information about executing thread and CPU.
size_t get_data_layout_dimension_index(const DataLayout &data_layout, const DataLayoutDimension &data_layout_dimension)
Get the index of the given dimension.
Describe a multidimensional execution window.
#define ARM_COMPUTE_RETURN_ERROR_ON_MSG(cond, msg)
If the condition is true, an error is returned.
Copyright (c) 2017-2024 Arm Limited.
std::tuple< int, int, int > scaled_3d_dimensions_signed(int width, int height, int depth, int kernel_width, int kernel_height, int kernel_depth, const Pooling3dLayerInfo &pool3d_info)
Returns calculated width, height and depth of output scaled tensor depending on dimensions rounding m...
@ F16
16-bit floating-point number
void run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) override
Execute the kernel on the passed window.
bool is_data_type_float(DataType dt)
Check if a given data type is of floating point type.
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
Store the tensor's metadata.
@ F32
32-bit floating-point number
void neon_fp16_pool3d(const ITensor *src0, ITensor *dst0, Pooling3dLayerInfo &, const Window &window)
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
@ NDHWC
Num samples, depth, height, width, channels.