decent-array 0.2.2__tar.gz → 0.2.3__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.
- {decent_array-0.2.2 → decent_array-0.2.3}/PKG-INFO +1 -1
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/_array.py +12 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/pyproject.toml +1 -1
- {decent_array-0.2.2 → decent_array-0.2.3}/tests/test_array.py +31 -1
- {decent_array-0.2.2 → decent_array-0.2.3}/.github/CODEOWNERS +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/.github/dependabot.yml +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/.github/workflows/ci.yaml +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/.gitignore +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/LICENSE +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/README.md +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/benchmarks/bench_array.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/benchmarks/bench_common.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/benchmarks/bench_iop.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/benchmarks/profile_hotpath.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/__init__.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/_constants.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/_errors.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/_utils.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/__init__.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_abstracts/__init__.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_abstracts/backend.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_backend_manager.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_iop/__init__.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_iop/bit_operators.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_iop/comparison.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_iop/creation.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_iop/linalg.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_iop/manipulations.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_iop/math.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_iop/operators.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_iop/reductions.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_iop/rng.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_iop/utils.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_jax/__init__.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_jax/jax_backend.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_numpy/__init__.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_numpy/numpy_backend.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_pytorch/__init__.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_pytorch/pytorch_backend.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_tensorflow/__init__.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_tensorflow/tensorflow_backend.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/py.typed +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/types/__init__.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/types/_dtypes.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/decent_array/types/_types.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/docs/Makefile +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/docs/make.bat +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/docs/requirements.txt +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/docs/source/_static/custom.css +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/docs/source/_static/logo.png +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/docs/source/_templates/module.rst.jinja +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/docs/source/_templates/package.rst.jinja +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/docs/source/api/decent_array.array.rst +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/docs/source/api/decent_array.interoperability.rst +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/docs/source/api/decent_array.rst +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/docs/source/api/decent_array.types.rst +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/docs/source/author.rst +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/docs/source/conf.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/docs/source/developer.rst +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/docs/source/index.rst +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/docs/source/user.rst +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/readthedocs.yaml +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/tests/conftest.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/tests/test_backend_manager.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/tests/test_dtypes.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/tests/test_iop_functions.py +0 -0
- {decent_array-0.2.2 → decent_array-0.2.3}/tests/test_iop_rng.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: decent-array
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: A library of array operations and linear algebra primitives for interoperability across ML frameworks.
|
|
5
5
|
Project-URL: Documentation, https://decent-array.readthedocs.io/en/latest/
|
|
6
6
|
Project-URL: Source, https://github.com/team-decent/decent-array
|
|
@@ -26,6 +26,7 @@ Hot-path notes:
|
|
|
26
26
|
|
|
27
27
|
from __future__ import annotations
|
|
28
28
|
|
|
29
|
+
from collections.abc import Callable
|
|
29
30
|
from typing import TYPE_CHECKING, Any, Self
|
|
30
31
|
|
|
31
32
|
from decent_array.interoperability._backend_manager import register_backend_listener
|
|
@@ -49,6 +50,11 @@ def _update_backend(backend: Backend | None) -> None:
|
|
|
49
50
|
register_backend_listener(_update_backend)
|
|
50
51
|
|
|
51
52
|
|
|
53
|
+
def _reconstruct_array(value: ArrayTypes) -> Array:
|
|
54
|
+
"""Reconstruct array after pickling."""
|
|
55
|
+
return Array(value)
|
|
56
|
+
|
|
57
|
+
|
|
52
58
|
class Array:
|
|
53
59
|
"""
|
|
54
60
|
Wrapper around a single backend-native array.
|
|
@@ -391,6 +397,12 @@ class Array:
|
|
|
391
397
|
memo[id(self)] = copied
|
|
392
398
|
return copied
|
|
393
399
|
|
|
400
|
+
# Pickle/unpickle --------------------------------------------------------
|
|
401
|
+
|
|
402
|
+
def __reduce__(self) -> tuple[Callable[..., Array], tuple[ArrayTypes]]:
|
|
403
|
+
"""Handle unpickling of the array."""
|
|
404
|
+
return (_reconstruct_array, (self.value,))
|
|
405
|
+
|
|
394
406
|
# Properties -----------------------------------------------------------
|
|
395
407
|
|
|
396
408
|
@property
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "decent-array"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.3"
|
|
4
4
|
authors = [{name = "Simon Granström"}, {name = "Nicola Bastianello"}]
|
|
5
5
|
maintainers = [{name = "Team Decent"}]
|
|
6
6
|
description = "A library of array operations and linear algebra primitives for interoperability across ML frameworks."
|
|
@@ -575,9 +575,39 @@ def test_item_n_dim(backend: tuple) -> None:
|
|
|
575
575
|
def test_deepcopy(backend: tuple) -> None:
|
|
576
576
|
from copy import deepcopy
|
|
577
577
|
|
|
578
|
-
src =
|
|
578
|
+
src = _create_array([1.0, 2.0, 3.0])
|
|
579
579
|
dst = deepcopy(src)
|
|
580
580
|
np.testing.assert_allclose(_np(dst), [1.0, 2.0, 3.0])
|
|
581
581
|
# Mutating the copy shouldn't affect the original.
|
|
582
582
|
dst[0] = 99.0
|
|
583
583
|
np.testing.assert_allclose(_np(src), [1.0, 2.0, 3.0])
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
# Pickle/unpickle --------------------------------------------------------
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
def test_pickle(backend: tuple) -> None:
|
|
590
|
+
import pickle
|
|
591
|
+
|
|
592
|
+
original = _create_array([1.0, 2.0, 3.0])
|
|
593
|
+
|
|
594
|
+
payload = pickle.dumps(
|
|
595
|
+
original,
|
|
596
|
+
protocol=pickle.HIGHEST_PROTOCOL,
|
|
597
|
+
)
|
|
598
|
+
|
|
599
|
+
restored = pickle.loads(payload)
|
|
600
|
+
|
|
601
|
+
np.testing.assert_array_equal(_np(restored.value), _np(original.value))
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
def test_pickle_uses_reduce(backend: tuple) -> None:
|
|
605
|
+
import pickle
|
|
606
|
+
from unittest.mock import patch
|
|
607
|
+
|
|
608
|
+
array = _create_array([1.0, 2.0, 3.0])
|
|
609
|
+
|
|
610
|
+
with patch.object(Array, "__reduce__", wraps=array.__reduce__) as reduce:
|
|
611
|
+
payload = pickle.dumps(array)
|
|
612
|
+
|
|
613
|
+
reduce.assert_called_once()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_abstracts/__init__.py
RENAMED
|
File without changes
|
{decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_abstracts/backend.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_iop/bit_operators.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_iop/manipulations.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_numpy/numpy_backend.py
RENAMED
|
File without changes
|
{decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_pytorch/__init__.py
RENAMED
|
File without changes
|
{decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_pytorch/pytorch_backend.py
RENAMED
|
File without changes
|
{decent_array-0.2.2 → decent_array-0.2.3}/decent_array/interoperability/_tensorflow/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|