# Custom comparators Source: [https://docs.qualcomm.com/doc/80-PT790-993B/topic/Custom-comparators.html](https://docs.qualcomm.com/doc/80-PT790-993B/topic/Custom-comparators.html) Users can configure one or more custom defined comparators per layer. Custom comparators are defined in a Python class extending the `qaic_pytools.common.Comparators` class and implementing a single compare method. Example: mycomp.py class XYZ_cmp(Comparators): def __init__(self, tol=1e-5): # tol holds the tolerance threshold value passed by user. # to be used accordingly by the comparison logic. self._tol = tol def display_name(self): # A string used to show the Column name in the final report. return 'xyz(%)' def compare(self, op1, op2): # write compare logic # op1 and op2 are two flattened numpy tensor outputs for the layer # return percent match (0 -> 100) # match_info string to give details on the mismatch or for edge cases. return 100.0, match_infoCopy to clipboard - The custom comparator Python files are copied inside the directory configured in defaults.yaml configuration field `common.custom_comparators_path`. - There could be more than one comparator class defined in same Python file. - Once created, the string returned by name() can be used as the comparator name like any other inbuilt comparators. **Parent Topic:** [Accuracy analyzer](https://docs.qualcomm.com/doc/80-PT790-993B/topic/accuracy_analyzer_chapter.html) Last Published: Jul 26, 2023