| 55 | } |
| 56 | |
| 57 | Status validate_arguments(const ITensorInfo *src, const ITensorInfo *dst, const PermutationVector &perm) |
| 58 | { |
| 59 | ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(src, dst); |
| 60 | ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(src); |
| 61 | ARM_COMPUTE_RETURN_ERROR_ON(src->data_type() == DataType::UNKNOWN); |
| 62 | ARM_COMPUTE_RETURN_ERROR_ON_MSG(src->num_dimensions() < 1 || src->num_dimensions() > 4, |
| 63 | "Permutation up to 4-D src tensor is supported"); |
| 64 | ARM_COMPUTE_RETURN_ERROR_ON_MSG(perm.num_dimensions() < 1 || perm.num_dimensions() > 4, |
| 65 | "Permutation vector size should be less than or equal to 4"); |
| 66 | for (const auto &p : perm) |
| 67 | { |
| 68 | ARM_COMPUTE_RETURN_ERROR_ON_MSG(p >= perm.num_dimensions(), "Permutation vector has invalid values"); |
| 69 | } |
| 70 | |
| 71 | const TensorShape dst_shape = misc::shape_calculator::compute_permutation_output_shape(*src, perm); |
| 72 | |
| 73 | // Validate configured dst |
| 74 | if (dst->total_size() != 0) |
| 75 | { |
| 76 | ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(dst); |
| 77 | ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DIMENSIONS(dst->tensor_shape(), dst_shape); |
| 78 | ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_QUANTIZATION_INFO(src, dst); |
| 79 | ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(src, dst); |
| 80 | } |
| 81 | else |
| 82 | { |
| 83 | const TensorInfo dst_info(dst_shape, src->num_channels(), src->data_type()); |
| 84 | ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(&dst_info); |
| 85 | } |
| 86 | return Status{}; |
| 87 | } |
| 88 | } // namespace |
| 89 | |
| 90 | ClPermuteKernel::ClPermuteKernel() |
no test coverage detected