| 222 | } |
| 223 | |
| 224 | Status NECropKernel::validate(const ITensorInfo *input, |
| 225 | const ITensorInfo *crop_boxes, |
| 226 | const ITensorInfo *box_ind, |
| 227 | const ITensorInfo *output, |
| 228 | uint32_t crop_box_ind, |
| 229 | float extrapolation_value) |
| 230 | { |
| 231 | ARM_COMPUTE_UNUSED(extrapolation_value); |
| 232 | ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, crop_boxes, box_ind, output); |
| 233 | ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(input, crop_boxes, box_ind); |
| 234 | const auto *uk = get_implementation(CropSelectorData{input->data_type()}); |
| 235 | ARM_COMPUTE_RETURN_ERROR_ON(uk == nullptr || uk->ukernel == nullptr); |
| 236 | |
| 237 | ARM_COMPUTE_RETURN_ERROR_ON_CPU_F16_UNSUPPORTED(input); |
| 238 | ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U8, DataType::U16, DataType::S16, |
| 239 | DataType::F16, DataType::U32, DataType::S32, DataType::F32); |
| 240 | ARM_COMPUTE_RETURN_ERROR_ON_DATA_LAYOUT_NOT_IN(input, DataLayout::NHWC); |
| 241 | ARM_COMPUTE_RETURN_ERROR_ON(input->tensor_shape().num_dimensions() > 4); |
| 242 | ARM_COMPUTE_RETURN_ERROR_ON(crop_boxes->tensor_shape()[0] != 4); |
| 243 | ARM_COMPUTE_RETURN_ERROR_ON(crop_boxes->tensor_shape()[1] != box_ind->tensor_shape()[0]); |
| 244 | ARM_COMPUTE_RETURN_ERROR_ON(crop_boxes->tensor_shape()[1] <= crop_box_ind); |
| 245 | ARM_COMPUTE_RETURN_ERROR_ON(box_ind->tensor_shape()[0] <= crop_box_ind); |
| 246 | if (output->total_size() > 0) |
| 247 | { |
| 248 | ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(output); |
| 249 | ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_NOT_IN(output, DataType::F32); |
| 250 | ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_LAYOUT(input, output); |
| 251 | ARM_COMPUTE_RETURN_ERROR_ON(output->num_dimensions() != 3); |
| 252 | ARM_COMPUTE_RETURN_ERROR_ON(output->has_padding()); |
| 253 | } |
| 254 | else |
| 255 | { |
| 256 | // Complicated, but since it's crop, `output` should be no larger than |
| 257 | // `input` anyway, so there's nothing extra to check in this case. |
| 258 | } |
| 259 | return Status{}; |
| 260 | } |
| 261 | |
| 262 | void NECropKernel::configure_output_shape() |
| 263 | { |
nothing calls this directly
no test coverage detected