mirror of
https://github.com/CHN-beta/nixpkgs.git
synced 2026-01-13 11:30:35 +08:00
37 lines
2.1 KiB
Diff
37 lines
2.1 KiB
Diff
--- a/numpy/core/tests/test_umath_accuracy.py 2023-07-09 03:25:45.476263000 +0800
|
|
+++ b/numpy/core/tests/test_umath_accuracy.py 2023-08-10 16:42:01.847961778 +0800
|
|
@@ -38,33 +38,6 @@
|
|
str_to_float = np.vectorize(convert)
|
|
|
|
class TestAccuracy:
|
|
- @platform_skip
|
|
- def test_validate_transcendentals(self):
|
|
- with np.errstate(all='ignore'):
|
|
- data_dir = path.join(path.dirname(__file__), 'data')
|
|
- files = os.listdir(data_dir)
|
|
- files = list(filter(lambda f: f.endswith('.csv'), files))
|
|
- for filename in files:
|
|
- filepath = path.join(data_dir, filename)
|
|
- with open(filepath) as fid:
|
|
- file_without_comments = (r for r in fid if not r[0] in ('$', '#'))
|
|
- data = np.genfromtxt(file_without_comments,
|
|
- dtype=('|S39','|S39','|S39',int),
|
|
- names=('type','input','output','ulperr'),
|
|
- delimiter=',',
|
|
- skip_header=1)
|
|
- npname = path.splitext(filename)[0].split('-')[3]
|
|
- npfunc = getattr(np, npname)
|
|
- for datatype in np.unique(data['type']):
|
|
- data_subset = data[data['type'] == datatype]
|
|
- inval = np.array(str_to_float(data_subset['input'].astype(str), data_subset['type'].astype(str)), dtype=eval(datatype))
|
|
- outval = np.array(str_to_float(data_subset['output'].astype(str), data_subset['type'].astype(str)), dtype=eval(datatype))
|
|
- perm = np.random.permutation(len(inval))
|
|
- inval = inval[perm]
|
|
- outval = outval[perm]
|
|
- maxulperr = data_subset['ulperr'].max()
|
|
- assert_array_max_ulp(npfunc(inval), outval, maxulperr)
|
|
-
|
|
@pytest.mark.parametrize("ufunc", UNARY_OBJECT_UFUNCS)
|
|
def test_validate_fp16_transcendentals(self, ufunc):
|
|
with np.errstate(all='ignore'):
|