-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update changelog * minor adjustment to stype algorithm * Added extra tests * Added type deduction tests for major constructors * Do not gate scalar type based on integer size, just use double * rework type deduction in dlpack parsing * formatting? * Update CHANGELOG
- Loading branch information
1 parent
16a2cba
commit 0960fcd
Showing
7 changed files
with
104 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import numpy as np | ||
import pytest | ||
|
||
import roughpy as rp | ||
|
||
TYPE_DEDUCTION_WIDTH = 3 | ||
TYPE_DEDUCTION_DEPTH = 3 | ||
|
||
TYPE_DEDUCTION_ARGS = [ | ||
(1, rp.DPReal), | ||
(1.0, rp.DPReal), | ||
([1], rp.DPReal), | ||
([1.0], rp.DPReal), | ||
(np.array([1], dtype="int32"), rp.DPReal), | ||
(np.array([1.0], dtype="float32"), rp.SPReal), | ||
(np.array([1.0], dtype="float64"), rp.DPReal), | ||
] | ||
|
||
|
||
@pytest.mark.parametrize("data,typ", TYPE_DEDUCTION_ARGS) | ||
def test_ft_ctor_type_deduction(data, typ): | ||
f = rp.ShuffleTensor(data, width=TYPE_DEDUCTION_WIDTH, depth=TYPE_DEDUCTION_DEPTH) | ||
|
||
assert f.dtype == typ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters