| 96 | } |
| 97 | |
| 98 | Status NEUnstack::validate(const ITensorInfo *input, const std::vector<ITensorInfo *> &output_vector, int axis) |
| 99 | { |
| 100 | ARM_COMPUTE_TRACE_EVENT(ARM_COMPUTE_PROF_CAT_CPU, ARM_COMPUTE_PROF_LVL_CPU, "NEUnstack::validate"); |
| 101 | ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input); |
| 102 | ARM_COMPUTE_RETURN_ERROR_ON(output_vector.empty()); |
| 103 | ARM_COMPUTE_RETURN_ERROR_ON(axis < (-static_cast<int>(input->tensor_shape().num_dimensions()))); |
| 104 | ARM_COMPUTE_RETURN_ERROR_ON(axis >= static_cast<int>(input->tensor_shape().num_dimensions())); |
| 105 | |
| 106 | ARM_COMPUTE_RETURN_ERROR_ON_DYNAMIC_SHAPE(input); |
| 107 | for (const auto &output : output_vector) |
| 108 | { |
| 109 | ARM_COMPUTE_RETURN_ERROR_ON_DYNAMIC_SHAPE(output); |
| 110 | } |
| 111 | |
| 112 | const unsigned int num_slices = std::min(output_vector.size(), input->dimension(wrap_axis(axis, input))); |
| 113 | ARM_COMPUTE_RETURN_ERROR_ON(num_slices > input->dimension(wrap_axis(axis, input))); |
| 114 | ARM_COMPUTE_RETURN_ERROR_ON(num_slices > output_vector.size()); |
| 115 | |
| 116 | Coordinates slice_start; |
| 117 | int32_t slice_end_mask; |
| 118 | for (size_t k = 0; k < num_slices; ++k) |
| 119 | { |
| 120 | slice_start.set(wrap_axis(axis, input), k); |
| 121 | setup_slice_coordinates_and_mask(slice_start, slice_end_mask, input->tensor_shape().num_dimensions()); |
| 122 | ARM_COMPUTE_RETURN_ON_ERROR(NEStridedSlice::validate(input, output_vector[k], slice_start, Coordinates(), |
| 123 | BiStrides(), 0, slice_end_mask, |
| 124 | (1 << wrap_axis(axis, input)))); |
| 125 | } |
| 126 | return Status{}; |
| 127 | } |
| 128 | |
| 129 | void NEUnstack::run() |
| 130 | { |
nothing calls this directly
no test coverage detected