File tree Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,19 @@ def assert_dtype_allclose(
108108 _assert_dtype (dpnp_arr .dtype , numpy_arr .dtype , check_only_type_kind )
109109
110110
111+ def factor_to_tol (dtype , factor ):
112+ """
113+ Calculate the tolerance for comparing floating point and complex arrays.
114+ The tolerance is based on the maximum resolution of the input dtype multiplied by the factor.
115+ """
116+
117+ tol = 0
118+ if numpy .issubdtype (dtype , numpy .inexact ):
119+ tol = numpy .finfo (dtype ).resolution
120+
121+ return factor * tol
122+
123+
111124def generate_random_numpy_array (
112125 shape ,
113126 dtype = None ,
@@ -206,19 +219,6 @@ def generate_random_numpy_array(
206219 return a
207220
208221
209- def factor_to_tol (dtype , factor ):
210- """
211- Calculate the tolerance for comparing floating point and complex arrays.
212- The tolerance is based on the maximum resolution of the input dtype multiplied by the factor.
213- """
214-
215- tol = 0
216- if numpy .issubdtype (dtype , numpy .inexact ):
217- tol = numpy .finfo (dtype ).resolution
218-
219- return factor * tol
220-
221-
222222def get_abs_array (data , dtype = None ):
223223 if numpy .issubdtype (dtype , numpy .unsignedinteger ):
224224 data = numpy .abs (data )
You can’t perform that action at this time.
0 commit comments