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(
108
108
_assert_dtype (dpnp_arr .dtype , numpy_arr .dtype , check_only_type_kind )
109
109
110
110
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
+
111
124
def generate_random_numpy_array (
112
125
shape ,
113
126
dtype = None ,
@@ -206,19 +219,6 @@ def generate_random_numpy_array(
206
219
return a
207
220
208
221
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
-
222
222
def get_abs_array (data , dtype = None ):
223
223
if numpy .issubdtype (dtype , numpy .unsignedinteger ):
224
224
data = numpy .abs (data )
You can’t perform that action at this time.
0 commit comments