| 56 | REGISTER_FP32_NEON(arm_compute::cpu::neon_fp32_pool3d)}}; |
| 57 | |
| 58 | Status validate_arguments(const ITensorInfo *src, const ITensorInfo *dst, const Pooling3dLayerInfo &pool_info) |
| 59 | { |
| 60 | ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(src, dst); |
| 61 | ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(src); |
| 62 | ARM_COMPUTE_RETURN_ERROR_ON_MSG(src->data_layout() != DataLayout::NDHWC, "Only NDHWC layout supported"); |
| 63 | ARM_COMPUTE_RETURN_ERROR_ON_CPU_F16_UNSUPPORTED(src); |
| 64 | ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(src, 1, DataType::F16, DataType::F32, DataType::QASYMM8, |
| 65 | DataType::QASYMM8_SIGNED); |
| 66 | |
| 67 | ARM_COMPUTE_RETURN_ERROR_ON_MSG((!is_data_type_float(src->data_type())) && |
| 68 | (!pool_info.exclude_padding && (pool_info.pool_type == PoolingType::AVG)), |
| 69 | "Exclude padding is unsupported for non-float types for Avg op"); |
| 70 | |
| 71 | const auto data_layout = src->data_layout(); |
| 72 | const int idx_width = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH); |
| 73 | const int idx_height = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT); |
| 74 | const int idx_depth = get_data_layout_dimension_index(data_layout, DataLayoutDimension::DEPTH); |
| 75 | |
| 76 | const bool is_global_pooling = pool_info.is_global_pooling; |
| 77 | const unsigned int pool_size_x = is_global_pooling ? src->dimension(idx_width) : pool_info.pool_size.width; |
| 78 | const unsigned int pool_size_y = is_global_pooling ? src->dimension(idx_height) : pool_info.pool_size.height; |
| 79 | const unsigned int pool_size_z = is_global_pooling ? src->dimension(idx_depth) : pool_info.pool_size.depth; |
| 80 | |
| 81 | const unsigned int stride_x = pool_info.stride.x(); |
| 82 | const unsigned int stride_y = pool_info.stride.y(); |
| 83 | const unsigned int stride_z = pool_info.stride.z(); |
| 84 | |
| 85 | ARM_COMPUTE_RETURN_ERROR_ON((pool_size_x == 0) || (pool_size_y == 0) || (pool_size_z == 0)); |
| 86 | ARM_COMPUTE_RETURN_ERROR_ON((stride_x == 0) || (stride_y == 0) || (stride_z == 0)); |
| 87 | |
| 88 | int output_width = 0; |
| 89 | int output_height = 0; |
| 90 | int output_depth = 0; |
| 91 | |
| 92 | ARM_COMPUTE_RETURN_ERROR_ON_MSG(is_pool_3d_region_entirely_outside_input(pool_info), |
| 93 | "Pooling region that is entirely outside input tensor is unsupported"); |
| 94 | |
| 95 | std::tie(output_width, output_height, output_depth) = |
| 96 | scaled_3d_dimensions_signed(src->tensor_shape()[idx_width], src->tensor_shape()[idx_height], |
| 97 | src->tensor_shape()[idx_depth], pool_size_x, pool_size_y, pool_size_z, pool_info); |
| 98 | ARM_COMPUTE_RETURN_ERROR_ON_MSG((output_width < 1 || output_height < 1 || output_depth < 1), |
| 99 | "Calculated output dimension size is invalid"); |
| 100 | |
| 101 | const TensorShape output_shape = compute_pool3d_shape(src->tensor_shape(), pool_info); |
| 102 | |
| 103 | if (dst->total_size() != 0) |
| 104 | { |
| 105 | ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(dst); |
| 106 | ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(src, dst); |
| 107 | ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_LAYOUT(src, dst); |
| 108 | ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DIMENSIONS(output_shape, dst->tensor_shape()); |
| 109 | } |
| 110 | else |
| 111 | { |
| 112 | const TensorInfo dst_info(output_shape, src->num_channels(), src->data_type()); |
| 113 | ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(&dst_info); |
| 114 | } |
| 115 |
no test coverage detected