Georgios Pinitas | 7021ef0 | 2023-08-22 08:25:57 +0100 | [diff] [blame] | 1 | |
Jeremy Johnson | d80ea5e | 2024-01-03 10:54:12 +0000 | [diff] [blame] | 2 | // Copyright (c) 2023-2024, ARM Limited. |
Georgios Pinitas | 7021ef0 | 2023-08-22 08:25:57 +0100 | [diff] [blame] | 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | |
| 16 | #ifndef VERIFIERS_H_ |
| 17 | #define VERIFIERS_H_ |
| 18 | |
| 19 | #include "verify_utils.h" |
| 20 | |
| 21 | namespace TosaReference |
| 22 | { |
| 23 | /// \brief Perform dot-product based verification |
| 24 | /// |
| 25 | /// \param ref Reference tensor |
| 26 | /// \param refBnd Reference tensor when ran on abs(input) |
| 27 | /// \param imp Implementation resulting tensor |
| 28 | /// \param dpInfo Dot-product verification meta-data |
| 29 | /// |
| 30 | /// \return True if compliant else false |
| 31 | bool verifyDotProduct(const CTensor* ref, |
| 32 | const CTensor* refBnd, |
| 33 | const CTensor* imp, |
| 34 | const DotProductVerifyInfo& dpInfo); |
| 35 | |
Jack Frankland | aafc850 | 2023-09-13 11:03:50 +0100 | [diff] [blame] | 36 | /// \brief Perform exact result verification |
| 37 | /// |
| 38 | /// \param referenceTensor Reference tensor |
| 39 | /// \param implementationTensor Implementation resulting tensor |
| 40 | /// |
| 41 | /// \return True if compliant else false |
| 42 | bool verifyExact(const CTensor* referenceTensor, const CTensor* implementationTensor); |
| 43 | |
Jack Frankland | 12ee1a7 | 2023-09-20 09:08:34 +0100 | [diff] [blame] | 44 | /// \brief Perform reduce product result verification |
| 45 | /// |
| 46 | /// \param referenceTensor Reference tensor |
| 47 | /// \param implementationTensor Implementation resulting tensor |
Jeremy Johnson | bd80196 | 2024-01-03 17:07:44 +0000 | [diff] [blame] | 48 | /// \param rpInfo Reduce-product verification meta-data |
Jack Frankland | 12ee1a7 | 2023-09-20 09:08:34 +0100 | [diff] [blame] | 49 | /// |
| 50 | /// \return True if compliant else false |
Jeremy Johnson | bd80196 | 2024-01-03 17:07:44 +0000 | [diff] [blame] | 51 | bool verifyReduceProduct(const CTensor* referenceTensor, |
| 52 | const CTensor* implementationTensor, |
| 53 | const ReduceProductVerifyInfo& rpInfo); |
Jack Frankland | 12ee1a7 | 2023-09-20 09:08:34 +0100 | [diff] [blame] | 54 | |
Jack Frankland | 62737b1 | 2023-09-13 15:47:48 +0100 | [diff] [blame] | 55 | /// \brief Perform ULP result verification |
| 56 | /// |
| 57 | /// \param referenceTensor Reference tensor |
| 58 | /// \param implementationTensor Implementation resulting tensor |
Jeremy Johnson | d80ea5e | 2024-01-03 10:54:12 +0000 | [diff] [blame] | 59 | /// \param ulpInfo The ULP tolerence info for the comparison of the two tensors |
Jack Frankland | 62737b1 | 2023-09-13 15:47:48 +0100 | [diff] [blame] | 60 | /// |
| 61 | /// \return True if compliant else false |
Jeremy Johnson | d80ea5e | 2024-01-03 10:54:12 +0000 | [diff] [blame] | 62 | bool verifyULP(const CTensor* referenceTensor, const CTensor* implementationTensor, const UlpVerifyInfo& ulpInfo); |
Jack Frankland | 62737b1 | 2023-09-13 15:47:48 +0100 | [diff] [blame] | 63 | |
Jeremy Johnson | 9a75838 | 2023-11-07 16:27:35 +0000 | [diff] [blame] | 64 | /// \brief Perform abs-error based verification |
| 65 | /// |
| 66 | /// \param ref Reference tensor |
| 67 | /// \param refBnd Reference bounds tensor (according to op) |
| 68 | /// \param imp Implementation resulting tensor |
Jeremy Johnson | d80ea5e | 2024-01-03 10:54:12 +0000 | [diff] [blame] | 69 | /// \param aeInfo Abs-error verification meta-data |
Jeremy Johnson | 9a75838 | 2023-11-07 16:27:35 +0000 | [diff] [blame] | 70 | /// |
| 71 | /// \return True if compliant else false |
Jeremy Johnson | d80ea5e | 2024-01-03 10:54:12 +0000 | [diff] [blame] | 72 | bool verifyAbsError(const CTensor* ref, const CTensor* refBnd, const CTensor* imp, const AbsErrorVerifyInfo& aeInfo); |
Jeremy Johnson | 9a75838 | 2023-11-07 16:27:35 +0000 | [diff] [blame] | 73 | |
Jeremy Johnson | 32d0b5a | 2024-02-01 15:54:07 +0000 | [diff] [blame^] | 74 | /// \brief Perform relative result verification |
| 75 | /// |
| 76 | /// \param referenceTensor Reference tensor |
| 77 | /// \param implementationTensor Implementation resulting tensor |
| 78 | /// \param rInfo Relative verification meta-data |
| 79 | /// |
| 80 | /// \return True if compliant else false |
| 81 | bool verifyRelative(const CTensor* referenceTensor, |
| 82 | const CTensor* implementationTensor, |
| 83 | const RelativeVerifyInfo& rInfo); |
| 84 | |
Georgios Pinitas | 7021ef0 | 2023-08-22 08:25:57 +0100 | [diff] [blame] | 85 | }; // namespace TosaReference |
| 86 | |
| 87 | #endif // VERIFIERS_H_ |