| 1 | // |
| 2 | // SPDX-FileCopyrightText: Copyright 2025-2026 Arm Limited and/or its affiliates <open-source-office@arm.com> |
| 3 | // |
| 4 | // SPDX-License-Identifier: Apache-2.0 |
| 5 | // |
| 6 | |
| 7 | #pragma once |
| 8 | |
| 9 | #include <cstddef> |
| 10 | |
| 11 | #include "test/common/buffer.hpp" |
| 12 | #include "test/common/data_type.hpp" |
| 13 | #include "test/nextgen/common/shape.hpp" |
| 14 | |
| 15 | namespace kai::test { |
| 16 | |
| 17 | /// Performs unary elementwise operator. |
| 18 | /// |
| 19 | /// @param[in] shape The size of multidimensional array. |
| 20 | /// @param[in] data The data buffer. |
| 21 | /// |
| 22 | /// @return The result data. |
| 23 | using UnaryElementwiseFn = Buffer (*)(Shape shape, Span<const std::byte> data); |
| 24 | |
| 25 | /// Creates a negate operator for the specified data type. |
| 26 | /// |
| 27 | /// @param[in] dtype The data type. |
| 28 | /// |
| 29 | /// @return The function pointer. |
| 30 | [[nodiscard]] UnaryElementwiseFn make_negate(DataType dtype); |
| 31 | |
| 32 | /// Creates an operator to change the signedness of the specified data type. |
| 33 | /// |
| 34 | /// This operator will add the middle point to each value so that the output data |
| 35 | /// is always within range. |
| 36 | /// |
| 37 | /// @param[in] dtype The data type. |
| 38 | /// |
| 39 | /// @return The function pointer. |
| 40 | [[nodiscard]] UnaryElementwiseFn make_change_signedness(DataType dtype); |
| 41 | |
| 42 | } // namespace kai::test |