Commit 2e78bbb
committed
Modularized common checks, added tests to cover change in functionality
Fixed test_arange and added test_arange_mixed_dtype
The test_arange test was specifying out of bounds starting value
for certain types.
Added tests to based on examples highlighting discrepancies.
dpt.arange(-2.5, stop=200, step=100, dtype='int32') now produces
the sequence consistent with np.arange output.
So does dpt.arange(9.7, stop=200, step=100, dtype='i4')
```ipython
In [1]: import dpctl, dpctl.tensor as dpt, numpy as np
In [2]: dpt.asnumpy(dpt.arange(9.7, stop=200, step=100, dtype='i4'))
Out[2]: array([ 9, 109], dtype=int32)
In [3]: np.arange(9.7, stop=200, step=100, dtype='i4')
Out[3]: array([ 9, 109], dtype=int32)
```
```
ty = np.float32
assert (
dpt.arange(
ty(0), stop=ty(504.0), step=ty(100), dtype=ty
).shape == (5,)
)
```
```
In [4]: import numpy as np
In [5]: np.arange(-5, stop=10**5, step=2.7, dtype=np.int64).shape
Out[5]: (37039,)
In [6]: import dpctl.tensor as dpt
In [7]: dpt.arange(-5, stop=10**5, step=2.7, dtype=np.int64).shape
Out[7]: (50003,)
```1 parent 9700b94 commit 2e78bbb
File tree
3 files changed
+134
-166
lines changed- dpctl/tests
- helper
3 files changed
+134
-166
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| 34 | + | |
| 35 | + | |
32 | 36 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
0 commit comments