array-api-shape-check 0.1.0__tar.gz → 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {array_api_shape_check-0.1.0/src/array_api_shape_check.egg-info → array_api_shape_check-0.1.1}/PKG-INFO +2 -8
- {array_api_shape_check-0.1.0 → array_api_shape_check-0.1.1}/README.md +1 -7
- {array_api_shape_check-0.1.0 → array_api_shape_check-0.1.1}/pyproject.toml +1 -1
- {array_api_shape_check-0.1.0 → array_api_shape_check-0.1.1}/src/array_api_shape_check/__init__.py +1 -1
- {array_api_shape_check-0.1.0 → array_api_shape_check-0.1.1}/src/array_api_shape_check/_main.py +18 -7
- {array_api_shape_check-0.1.0 → array_api_shape_check-0.1.1/src/array_api_shape_check.egg-info}/PKG-INFO +2 -8
- {array_api_shape_check-0.1.0 → array_api_shape_check-0.1.1}/LICENSE +0 -0
- {array_api_shape_check-0.1.0 → array_api_shape_check-0.1.1}/setup.cfg +0 -0
- {array_api_shape_check-0.1.0 → array_api_shape_check-0.1.1}/src/array_api_shape_check/py.typed +0 -0
- {array_api_shape_check-0.1.0 → array_api_shape_check-0.1.1}/src/array_api_shape_check.egg-info/SOURCES.txt +0 -0
- {array_api_shape_check-0.1.0 → array_api_shape_check-0.1.1}/src/array_api_shape_check.egg-info/dependency_links.txt +0 -0
- {array_api_shape_check-0.1.0 → array_api_shape_check-0.1.1}/src/array_api_shape_check.egg-info/requires.txt +0 -0
- {array_api_shape_check-0.1.0 → array_api_shape_check-0.1.1}/src/array_api_shape_check.egg-info/top_level.txt +0 -0
- {array_api_shape_check-0.1.0 → array_api_shape_check-0.1.1}/tests/test_main.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: array-api-shape-check
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: Check shapes of input arrays easily
|
|
5
5
|
Author-email: 34j <34j.95a2p@simplelogin.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -107,13 +107,7 @@ Not enough information to determine variable subscript ndims:
|
|
|
107
107
|
>>> import pytest
|
|
108
108
|
>>> from array_api_shape_check import InconsistentNdimErrorMultipleSolutions, InconsistentNdimErrorNoSolutions, InconsistentShapeError
|
|
109
109
|
>>> with pytest.raises(InconsistentNdimErrorMultipleSolutions, match="number of variables"):
|
|
110
|
-
... check_shapes(
|
|
111
|
-
... "*i*j",
|
|
112
|
-
... (
|
|
113
|
-
... 1,
|
|
114
|
-
... 1,
|
|
115
|
-
... ),
|
|
116
|
-
... )
|
|
110
|
+
... check_shapes("*i*j", (1, 1))
|
|
117
111
|
>>> with pytest.raises(InconsistentNdimErrorMultipleSolutions, match="rank"):
|
|
118
112
|
... check_shapes("*i*j,*i*j", (1, 1), (1, 1))
|
|
119
113
|
```
|
|
@@ -79,13 +79,7 @@ Not enough information to determine variable subscript ndims:
|
|
|
79
79
|
>>> import pytest
|
|
80
80
|
>>> from array_api_shape_check import InconsistentNdimErrorMultipleSolutions, InconsistentNdimErrorNoSolutions, InconsistentShapeError
|
|
81
81
|
>>> with pytest.raises(InconsistentNdimErrorMultipleSolutions, match="number of variables"):
|
|
82
|
-
... check_shapes(
|
|
83
|
-
... "*i*j",
|
|
84
|
-
... (
|
|
85
|
-
... 1,
|
|
86
|
-
... 1,
|
|
87
|
-
... ),
|
|
88
|
-
... )
|
|
82
|
+
... check_shapes("*i*j", (1, 1))
|
|
89
83
|
>>> with pytest.raises(InconsistentNdimErrorMultipleSolutions, match="rank"):
|
|
90
84
|
... check_shapes("*i*j,*i*j", (1, 1), (1, 1))
|
|
91
85
|
```
|
{array_api_shape_check-0.1.0 → array_api_shape_check-0.1.1}/src/array_api_shape_check/_main.py
RENAMED
|
@@ -365,17 +365,28 @@ def check_shapes(
|
|
|
365
365
|
>>> info.unique
|
|
366
366
|
(i:3, j:4, *k:(5,), *l:(6, 7))
|
|
367
367
|
|
|
368
|
+
Internally `check_shapes()` calls `parse_variable_ndim()`,
|
|
369
|
+
which determines the number of dimensions for variable subscripts by least squares.
|
|
370
|
+
If this is successful, checks if each subscript is consistent,
|
|
371
|
+
then finnaly raises error for all inconsistencies at once.
|
|
372
|
+
|
|
373
|
+
Diving into the details of the first item:
|
|
374
|
+
|
|
375
|
+
>>> item = info.all[0][0]
|
|
376
|
+
>>> item.name # the name of the subscript
|
|
377
|
+
'i'
|
|
378
|
+
>>> item.is_variable # whether the subscript is variable (starts with "*")
|
|
379
|
+
False
|
|
380
|
+
>>> item.shape_current # the current shape of the subscript
|
|
381
|
+
(1,)
|
|
382
|
+
>>> item.shape_broadcasted # the broadcasted shape of the subscript
|
|
383
|
+
(3,)
|
|
384
|
+
|
|
368
385
|
Not enough information to determine variable subscript ndims:
|
|
369
386
|
|
|
370
387
|
>>> import pytest
|
|
371
388
|
>>> with pytest.raises(InconsistentNdimErrorMultipleSolutions, match="number of variables"):
|
|
372
|
-
... check_shapes(
|
|
373
|
-
... "*i*j",
|
|
374
|
-
... (
|
|
375
|
-
... 1,
|
|
376
|
-
... 1,
|
|
377
|
-
... ),
|
|
378
|
-
... )
|
|
389
|
+
... check_shapes("*i*j", (1, 1))
|
|
379
390
|
>>> with pytest.raises(InconsistentNdimErrorMultipleSolutions, match="rank"):
|
|
380
391
|
... check_shapes("*i*j,*i*j", (1, 1), (1, 1))
|
|
381
392
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: array-api-shape-check
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: Check shapes of input arrays easily
|
|
5
5
|
Author-email: 34j <34j.95a2p@simplelogin.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -107,13 +107,7 @@ Not enough information to determine variable subscript ndims:
|
|
|
107
107
|
>>> import pytest
|
|
108
108
|
>>> from array_api_shape_check import InconsistentNdimErrorMultipleSolutions, InconsistentNdimErrorNoSolutions, InconsistentShapeError
|
|
109
109
|
>>> with pytest.raises(InconsistentNdimErrorMultipleSolutions, match="number of variables"):
|
|
110
|
-
... check_shapes(
|
|
111
|
-
... "*i*j",
|
|
112
|
-
... (
|
|
113
|
-
... 1,
|
|
114
|
-
... 1,
|
|
115
|
-
... ),
|
|
116
|
-
... )
|
|
110
|
+
... check_shapes("*i*j", (1, 1))
|
|
117
111
|
>>> with pytest.raises(InconsistentNdimErrorMultipleSolutions, match="rank"):
|
|
118
112
|
... check_shapes("*i*j,*i*j", (1, 1), (1, 1))
|
|
119
113
|
```
|
|
File without changes
|
|
File without changes
|
{array_api_shape_check-0.1.0 → array_api_shape_check-0.1.1}/src/array_api_shape_check/py.typed
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|