blob: 80b6e19cacbc420dac530464c3afcf86a78009bc [file] [log] [blame]
Georgios Pinitas7021ef02023-08-22 08:25:57 +01001
Jeremy Johnsond80ea5e2024-01-03 10:54:12 +00002// Copyright (c) 2023-2024, ARM Limited.
Georgios Pinitas7021ef02023-08-22 08:25:57 +01003//
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
21namespace 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
31bool verifyDotProduct(const CTensor* ref,
32 const CTensor* refBnd,
33 const CTensor* imp,
34 const DotProductVerifyInfo& dpInfo);
35
Jack Franklandaafc8502023-09-13 11:03:50 +010036/// \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
42bool verifyExact(const CTensor* referenceTensor, const CTensor* implementationTensor);
43
Jack Frankland12ee1a72023-09-20 09:08:34 +010044/// \brief Perform reduce product result verification
45///
46/// \param referenceTensor Reference tensor
47/// \param implementationTensor Implementation resulting tensor
Jeremy Johnsonbd801962024-01-03 17:07:44 +000048/// \param rpInfo Reduce-product verification meta-data
Jack Frankland12ee1a72023-09-20 09:08:34 +010049///
50/// \return True if compliant else false
Jeremy Johnsonbd801962024-01-03 17:07:44 +000051bool verifyReduceProduct(const CTensor* referenceTensor,
52 const CTensor* implementationTensor,
53 const ReduceProductVerifyInfo& rpInfo);
Jack Frankland12ee1a72023-09-20 09:08:34 +010054
Jack Frankland62737b12023-09-13 15:47:48 +010055/// \brief Perform ULP result verification
56///
57/// \param referenceTensor Reference tensor
58/// \param implementationTensor Implementation resulting tensor
Jeremy Johnsond80ea5e2024-01-03 10:54:12 +000059/// \param ulpInfo The ULP tolerence info for the comparison of the two tensors
Jack Frankland62737b12023-09-13 15:47:48 +010060///
61/// \return True if compliant else false
Jeremy Johnsond80ea5e2024-01-03 10:54:12 +000062bool verifyULP(const CTensor* referenceTensor, const CTensor* implementationTensor, const UlpVerifyInfo& ulpInfo);
Jack Frankland62737b12023-09-13 15:47:48 +010063
Jeremy Johnson9a758382023-11-07 16:27:35 +000064/// \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 Johnsond80ea5e2024-01-03 10:54:12 +000069/// \param aeInfo Abs-error verification meta-data
Jeremy Johnson9a758382023-11-07 16:27:35 +000070///
71/// \return True if compliant else false
Jeremy Johnsond80ea5e2024-01-03 10:54:12 +000072bool verifyAbsError(const CTensor* ref, const CTensor* refBnd, const CTensor* imp, const AbsErrorVerifyInfo& aeInfo);
Jeremy Johnson9a758382023-11-07 16:27:35 +000073
Jeremy Johnson32d0b5a2024-02-01 15:54:07 +000074/// \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
81bool verifyRelative(const CTensor* referenceTensor,
82 const CTensor* implementationTensor,
83 const RelativeVerifyInfo& rInfo);
84
Georgios Pinitas7021ef02023-08-22 08:25:57 +010085}; // namespace TosaReference
86
87#endif // VERIFIERS_H_