| 63 | }; |
| 64 | |
| 65 | Status validate_arguments(const ITensorInfo *src, |
| 66 | const ITensorInfo *dst, |
| 67 | const Size2D &kernel_dims, |
| 68 | const PadStrideInfo &conv_info, |
| 69 | bool has_bias, |
| 70 | const Size2D &dilation, |
| 71 | unsigned int num_groups) |
| 72 | { |
| 73 | ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(src, dst); |
| 74 | ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(src); |
| 75 | const unsigned int channel_idx = get_data_layout_dimension_index(src->data_layout(), DataLayoutDimension::CHANNEL); |
| 76 | |
| 77 | ARM_COMPUTE_RETURN_ERROR_ON_F16_UNSUPPORTED(src); |
| 78 | ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(src, 1, DataType::QASYMM8, DataType::QASYMM8_SIGNED, |
| 79 | DataType::F16, DataType::F32); |
| 80 | ARM_COMPUTE_RETURN_ERROR_ON(is_data_type_quantized(src->data_type()) && has_bias); |
| 81 | ARM_COMPUTE_RETURN_ERROR_ON((dilation.x() < 1) || (dilation.y() < 1)); |
| 82 | ARM_COMPUTE_RETURN_ERROR_ON(src->data_layout() == DataLayout::UNKNOWN); |
| 83 | ARM_COMPUTE_RETURN_ERROR_ON(num_groups == 0); |
| 84 | ARM_COMPUTE_RETURN_ERROR_ON(src->data_layout() == DataLayout::NHWC && num_groups > 1); |
| 85 | ARM_COMPUTE_RETURN_ERROR_ON((src->dimension(channel_idx) % num_groups) != 0); |
| 86 | |
| 87 | // Since there's no implicit padding added, check the total input spatial dimensions (with conv paddings) are big enough for the kernel dimensions |
| 88 | const unsigned int width_idx = get_data_layout_dimension_index(src->data_layout(), DataLayoutDimension::WIDTH); |
| 89 | const unsigned int height_idx = get_data_layout_dimension_index(src->data_layout(), DataLayoutDimension::HEIGHT); |
| 90 | const unsigned total_width = src->dimension(width_idx) + conv_info.pad_left() + conv_info.pad_right(); |
| 91 | const unsigned total_height = src->dimension(height_idx) + conv_info.pad_top() + conv_info.pad_bottom(); |
| 92 | ARM_COMPUTE_RETURN_ERROR_ON((total_width < kernel_dims.width) || (total_height < kernel_dims.height)); |
| 93 | |
| 94 | const TensorShape output_shape = |
| 95 | compute_im2col_conv_shape(src, kernel_dims, conv_info, has_bias, dilation, num_groups == 1, num_groups); |
| 96 | |
| 97 | if (dst->total_size() > 0) |
| 98 | { |
| 99 | ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(dst); |
| 100 | ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DIMENSIONS(dst->tensor_shape(), output_shape); |
| 101 | ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(src, dst); |
| 102 | ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_QUANTIZATION_INFO(src, dst); |
| 103 | } |
| 104 | else |
| 105 | { |
| 106 | const TensorInfo dst_info(output_shape, src->num_channels(), src->data_type()); |
| 107 | ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(&dst_info); |
| 108 | } |
| 109 | |
| 110 | return Status{}; |
| 111 | } |
| 112 | |
| 113 | std::pair<Status, Window> validate_and_configure_window(ITensorInfo *src, |
| 114 | ITensorInfo *dst, |
no test coverage detected