arraybridge 0.3.3__tar.gz → 0.3.4__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.
- {arraybridge-0.3.3 → arraybridge-0.3.4}/PKG-INFO +1 -1
- arraybridge-0.3.4/src/arraybridge/__init__.py +109 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/src/arraybridge/types.py +25 -21
- arraybridge-0.3.3/src/arraybridge/__init__.py +0 -75
- {arraybridge-0.3.3 → arraybridge-0.3.4}/.github/workflows/ci.yml +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/.github/workflows/coverage-pages.yml +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/.github/workflows/gpu-tests.yml +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/.github/workflows/publish.yml +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/.gitignore +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/.readthedocs.yml +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/ADDING_NEW_FRAMEWORKS.md +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/CONTRIBUTING.md +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/LICENSE +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/README.md +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/TESTING.md +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/Makefile +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/archive/CI_ARTIFACT_UPDATE.md +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/archive/CI_CUPY_FIX.md +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/archive/CI_IMPROVEMENTS.md +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/archive/CONFLICT_VISUALIZATION.md +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/archive/COVERAGE_AUDIT_PLAN.md +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/archive/DEPLOYMENT_SUMMARY.md +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/archive/GPU_TESTING_SETUP.md +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/archive/MERGE_CONFLICT_RESOLUTION.md +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/archive/MIGRATION_SUMMARY.md +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/archive/QUICK_FIX_GUIDE.txt +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/archive/README.md +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/archive/RESOLVED_FILES.md +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/ci-cd.md +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/source/.gitignore +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/source/Makefile +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/source/README.md +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/source/advanced_topics.rst +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/source/api_reference.rst +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/source/ci-cd.rst +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/source/conf.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/source/contributing.rst +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/source/converters.rst +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/source/decorators.rst +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/source/examples/basic_conversion.rst +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/source/examples/decorators.rst +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/source/examples/index.rst +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/source/examples/multi_framework.rst +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/source/gpu_features.rst +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/source/index.rst +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/source/installation.rst +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/source/quickstart.rst +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/source/stack_utils.rst +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/docs/source/user_guide.rst +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/paper.bib +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/paper.md +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/pyproject.toml +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/scripts/release.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/scripts/update_version.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/scripts/verify_release_ready.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/src/arraybridge/array_geometry.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/src/arraybridge/array_operations.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/src/arraybridge/array_payload.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/src/arraybridge/converters.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/src/arraybridge/converters_registry.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/src/arraybridge/decorators.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/src/arraybridge/dtype_scaling.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/src/arraybridge/exceptions.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/src/arraybridge/framework_config.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/src/arraybridge/framework_ops.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/src/arraybridge/gpu_cleanup.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/src/arraybridge/oom_recovery.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/src/arraybridge/slice_processing.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/src/arraybridge/stack_utils.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/src/arraybridge/utils.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/tests/__init__.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/tests/conftest.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/tests/test_array_geometry.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/tests/test_converters.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/tests/test_converters_registry.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/tests/test_decorators.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/tests/test_dtype_scaling.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/tests/test_exceptions.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/tests/test_framework_config.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/tests/test_gpu_cleanup.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/tests/test_integration.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/tests/test_oom_recovery.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/tests/test_registry_integration.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/tests/test_slice_processing.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/tests/test_stack_utils.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/tests/test_types.py +0 -0
- {arraybridge-0.3.3 → arraybridge-0.3.4}/tests/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: arraybridge
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Summary: Unified API for NumPy, CuPy, PyTorch, TensorFlow, JAX, and pyclesperanto with automatic memory type conversion
|
|
5
5
|
Project-URL: Homepage, https://github.com/OpenHCSDev/arraybridge
|
|
6
6
|
Project-URL: Documentation, https://arraybridge.readthedocs.io
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"""
|
|
2
|
+
arraybridge: Unified API for NumPy, CuPy, PyTorch, TensorFlow, JAX, and pyclesperanto.
|
|
3
|
+
|
|
4
|
+
This package provides automatic memory type conversion, declarative decorators,
|
|
5
|
+
and unified utilities for working with multiple array/tensor frameworks.
|
|
6
|
+
|
|
7
|
+
Package-root imports stay lightweight: submodule exports load on first
|
|
8
|
+
attribute access instead of at import time. Declaration-only consumers
|
|
9
|
+
(memory-type tables, configuration modules) therefore do not pay the
|
|
10
|
+
NumPy/numcodecs import cost.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
__version__ = "0.3.4"
|
|
14
|
+
|
|
15
|
+
_LAZY_EXPORTS: dict[str, str] = {
|
|
16
|
+
"MemoryType": ".types",
|
|
17
|
+
"MemoryContractAttribute": ".types",
|
|
18
|
+
"ArrayPayload": ".array_payload",
|
|
19
|
+
"ArrayGeometry": ".array_geometry",
|
|
20
|
+
"CPU_MEMORY_TYPES": ".types",
|
|
21
|
+
"GPU_MEMORY_TYPES": ".types",
|
|
22
|
+
"SUPPORTED_MEMORY_TYPES": ".types",
|
|
23
|
+
"convert_memory": ".converters",
|
|
24
|
+
"detect_memory_type": ".converters",
|
|
25
|
+
"memory_types": ".decorators",
|
|
26
|
+
"DtypeConversion": ".decorators",
|
|
27
|
+
"SliceBySliceRuntimeParameter": ".decorators",
|
|
28
|
+
"wrap_dtype_preserving_callable": ".decorators",
|
|
29
|
+
"stack_slices": ".stack_utils",
|
|
30
|
+
"unstack_slices": ".stack_utils",
|
|
31
|
+
"process_slices": ".slice_processing",
|
|
32
|
+
"cleanup_all_gpu_frameworks": ".gpu_cleanup",
|
|
33
|
+
"MemoryConversionError": ".exceptions",
|
|
34
|
+
"SCALING_FUNCTIONS": ".dtype_scaling",
|
|
35
|
+
"_FRAMEWORK_CONFIG": ".framework_config",
|
|
36
|
+
"_FRAMEWORK_OPS": ".framework_ops",
|
|
37
|
+
"_execute_with_oom_recovery": ".oom_recovery",
|
|
38
|
+
"_ensure_module": ".utils",
|
|
39
|
+
"_supports_dlpack": ".utils",
|
|
40
|
+
"_get_device_id": ".utils",
|
|
41
|
+
# Decorator exports named after each memory type (numpy, cupy, torch, ...).
|
|
42
|
+
"numpy": ".decorators",
|
|
43
|
+
"cupy": ".decorators",
|
|
44
|
+
"torch": ".decorators",
|
|
45
|
+
"tensorflow": ".decorators",
|
|
46
|
+
"jax": ".decorators",
|
|
47
|
+
"pyclesperanto": ".decorators",
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
__all__ = [
|
|
51
|
+
# Types
|
|
52
|
+
"MemoryType",
|
|
53
|
+
"MemoryContractAttribute",
|
|
54
|
+
"ArrayPayload",
|
|
55
|
+
"ArrayGeometry",
|
|
56
|
+
"CPU_MEMORY_TYPES",
|
|
57
|
+
"GPU_MEMORY_TYPES",
|
|
58
|
+
"SUPPORTED_MEMORY_TYPES",
|
|
59
|
+
# Converters
|
|
60
|
+
"convert_memory",
|
|
61
|
+
"detect_memory_type",
|
|
62
|
+
# Decorators
|
|
63
|
+
"memory_types",
|
|
64
|
+
"DtypeConversion",
|
|
65
|
+
"SliceBySliceRuntimeParameter",
|
|
66
|
+
"wrap_dtype_preserving_callable",
|
|
67
|
+
# Stack utilities
|
|
68
|
+
"stack_slices",
|
|
69
|
+
"unstack_slices",
|
|
70
|
+
# Slice processing
|
|
71
|
+
"process_slices",
|
|
72
|
+
# GPU cleanup
|
|
73
|
+
"cleanup_all_gpu_frameworks",
|
|
74
|
+
# Exceptions
|
|
75
|
+
"MemoryConversionError",
|
|
76
|
+
# Scaling
|
|
77
|
+
"SCALING_FUNCTIONS",
|
|
78
|
+
# Framework config (internal but needed by some consumers)
|
|
79
|
+
"_FRAMEWORK_CONFIG",
|
|
80
|
+
"_FRAMEWORK_OPS",
|
|
81
|
+
# OOM recovery
|
|
82
|
+
"_execute_with_oom_recovery",
|
|
83
|
+
# Utils
|
|
84
|
+
"_ensure_module",
|
|
85
|
+
"_supports_dlpack",
|
|
86
|
+
"_get_device_id",
|
|
87
|
+
"numpy",
|
|
88
|
+
"cupy",
|
|
89
|
+
"torch",
|
|
90
|
+
"tensorflow",
|
|
91
|
+
"jax",
|
|
92
|
+
"pyclesperanto",
|
|
93
|
+
]
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def __getattr__(name: str):
|
|
97
|
+
module_name = _LAZY_EXPORTS.get(name)
|
|
98
|
+
if module_name is None:
|
|
99
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
100
|
+
|
|
101
|
+
import importlib
|
|
102
|
+
|
|
103
|
+
value = getattr(importlib.import_module(module_name, __name__), name)
|
|
104
|
+
globals()[name] = value
|
|
105
|
+
return value
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def __dir__() -> list[str]:
|
|
109
|
+
return sorted(set(globals()) | set(_LAZY_EXPORTS))
|
|
@@ -5,6 +5,8 @@ This module defines the MemoryType enum and related constants for managing
|
|
|
5
5
|
different array/tensor frameworks.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
8
10
|
import importlib
|
|
9
11
|
import importlib.util
|
|
10
12
|
import logging
|
|
@@ -15,17 +17,10 @@ from contextlib import AbstractContextManager, contextmanager, nullcontext
|
|
|
15
17
|
from dataclasses import dataclass
|
|
16
18
|
from enum import Enum
|
|
17
19
|
from pathlib import Path
|
|
18
|
-
from typing import Any, TypeVar, cast
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
JAX_OPERATIONS,
|
|
23
|
-
NUMPY_OPERATIONS,
|
|
24
|
-
PYCLESPERANTO_OPERATIONS,
|
|
25
|
-
TENSORFLOW_OPERATIONS,
|
|
26
|
-
TORCH_OPERATIONS,
|
|
27
|
-
ArrayOperations,
|
|
28
|
-
)
|
|
20
|
+
from typing import TYPE_CHECKING, Any, TypeVar, cast
|
|
21
|
+
|
|
22
|
+
if TYPE_CHECKING:
|
|
23
|
+
from arraybridge.array_operations import ArrayOperations
|
|
29
24
|
|
|
30
25
|
T = TypeVar("T")
|
|
31
26
|
logger = logging.getLogger(__name__)
|
|
@@ -561,7 +556,7 @@ class _MemoryTypeFields:
|
|
|
561
556
|
module_aliases: tuple[str, ...]
|
|
562
557
|
import_environment: tuple[tuple[str, str], ...]
|
|
563
558
|
_runtime: FrameworkRuntime
|
|
564
|
-
|
|
559
|
+
_operations_name: str
|
|
565
560
|
|
|
566
561
|
|
|
567
562
|
class MemoryType(_MemoryTypeFields, Enum):
|
|
@@ -571,7 +566,7 @@ class MemoryType(_MemoryTypeFields, Enum):
|
|
|
571
566
|
cls,
|
|
572
567
|
value: str,
|
|
573
568
|
*declaration: Any,
|
|
574
|
-
) ->
|
|
569
|
+
) -> MemoryType:
|
|
575
570
|
(
|
|
576
571
|
import_name,
|
|
577
572
|
display_name,
|
|
@@ -589,9 +584,18 @@ class MemoryType(_MemoryTypeFields, Enum):
|
|
|
589
584
|
member.module_aliases = cast(tuple[str, ...], module_aliases)
|
|
590
585
|
member.import_environment = cast(tuple[tuple[str, str], ...], import_environment)
|
|
591
586
|
member._runtime = cast(FrameworkRuntime, runtime)
|
|
592
|
-
member.
|
|
587
|
+
member._operations_name = cast(str, operations)
|
|
593
588
|
return member
|
|
594
589
|
|
|
590
|
+
@property
|
|
591
|
+
def _operations(self) -> ArrayOperations:
|
|
592
|
+
"""Resolve this declaration's operations registry on first access."""
|
|
593
|
+
|
|
594
|
+
from arraybridge import array_operations
|
|
595
|
+
|
|
596
|
+
operations: ArrayOperations = getattr(array_operations, self._operations_name)
|
|
597
|
+
return operations
|
|
598
|
+
|
|
595
599
|
NUMPY = (
|
|
596
600
|
"numpy",
|
|
597
601
|
"numpy",
|
|
@@ -600,7 +604,7 @@ class MemoryType(_MemoryTypeFields, Enum):
|
|
|
600
604
|
(),
|
|
601
605
|
(),
|
|
602
606
|
FrameworkRuntime(oom_matcher=_numpy_oom),
|
|
603
|
-
NUMPY_OPERATIONS,
|
|
607
|
+
"NUMPY_OPERATIONS",
|
|
604
608
|
)
|
|
605
609
|
CUPY = (
|
|
606
610
|
"cupy",
|
|
@@ -624,7 +628,7 @@ class MemoryType(_MemoryTypeFields, Enum):
|
|
|
624
628
|
oom_matcher=_cupy_oom,
|
|
625
629
|
subprocess_environment=_nvidia_wheel_subprocess_environment,
|
|
626
630
|
),
|
|
627
|
-
CUPY_OPERATIONS,
|
|
631
|
+
"CUPY_OPERATIONS",
|
|
628
632
|
)
|
|
629
633
|
TORCH = (
|
|
630
634
|
"torch",
|
|
@@ -647,7 +651,7 @@ class MemoryType(_MemoryTypeFields, Enum):
|
|
|
647
651
|
dlpack_exporter=_protocol_dlpack_export,
|
|
648
652
|
oom_matcher=_torch_oom,
|
|
649
653
|
),
|
|
650
|
-
TORCH_OPERATIONS,
|
|
654
|
+
"TORCH_OPERATIONS",
|
|
651
655
|
)
|
|
652
656
|
TENSORFLOW = (
|
|
653
657
|
"tensorflow",
|
|
@@ -666,7 +670,7 @@ class MemoryType(_MemoryTypeFields, Enum):
|
|
|
666
670
|
dlpack_validator=_tensorflow_dlpack,
|
|
667
671
|
oom_matcher=_tensorflow_oom,
|
|
668
672
|
),
|
|
669
|
-
TENSORFLOW_OPERATIONS,
|
|
673
|
+
"TENSORFLOW_OPERATIONS",
|
|
670
674
|
)
|
|
671
675
|
JAX = (
|
|
672
676
|
"jax",
|
|
@@ -684,7 +688,7 @@ class MemoryType(_MemoryTypeFields, Enum):
|
|
|
684
688
|
dlpack_exporter=_protocol_dlpack_export,
|
|
685
689
|
oom_matcher=_jax_oom,
|
|
686
690
|
),
|
|
687
|
-
JAX_OPERATIONS,
|
|
691
|
+
"JAX_OPERATIONS",
|
|
688
692
|
)
|
|
689
693
|
PYCLESPERANTO = (
|
|
690
694
|
"pyclesperanto",
|
|
@@ -701,7 +705,7 @@ class MemoryType(_MemoryTypeFields, Enum):
|
|
|
701
705
|
move_to_active_device=_pyclesperanto_device_move,
|
|
702
706
|
oom_matcher=_pyclesperanto_oom,
|
|
703
707
|
),
|
|
704
|
-
PYCLESPERANTO_OPERATIONS,
|
|
708
|
+
"PYCLESPERANTO_OPERATIONS",
|
|
705
709
|
)
|
|
706
710
|
|
|
707
711
|
@property
|
|
@@ -953,7 +957,7 @@ class MemoryType(_MemoryTypeFields, Enum):
|
|
|
953
957
|
payload = data if isinstance(data, DLPackPayload) else DLPackPayload(data, data)
|
|
954
958
|
return importer(payload, framework)
|
|
955
959
|
|
|
956
|
-
def convert_to(self, data: Any, target:
|
|
960
|
+
def convert_to(self, data: Any, target: MemoryType, device_id: int) -> Any:
|
|
957
961
|
"""Convert one array through the source and target declarations."""
|
|
958
962
|
|
|
959
963
|
if self is target:
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
arraybridge: Unified API for NumPy, CuPy, PyTorch, TensorFlow, JAX, and pyclesperanto.
|
|
3
|
-
|
|
4
|
-
This package provides automatic memory type conversion, declarative decorators,
|
|
5
|
-
and unified utilities for working with multiple array/tensor frameworks.
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
__version__ = "0.3.3"
|
|
9
|
-
|
|
10
|
-
from . import decorators as _decorators
|
|
11
|
-
from .array_geometry import ArrayGeometry
|
|
12
|
-
from .array_payload import ArrayPayload
|
|
13
|
-
from .converters import convert_memory, detect_memory_type
|
|
14
|
-
from .dtype_scaling import SCALING_FUNCTIONS
|
|
15
|
-
from .exceptions import MemoryConversionError
|
|
16
|
-
from .framework_config import _FRAMEWORK_CONFIG
|
|
17
|
-
from .framework_ops import _FRAMEWORK_OPS
|
|
18
|
-
from .gpu_cleanup import cleanup_all_gpu_frameworks
|
|
19
|
-
from .oom_recovery import _execute_with_oom_recovery
|
|
20
|
-
from .slice_processing import process_slices
|
|
21
|
-
from .stack_utils import stack_slices, unstack_slices
|
|
22
|
-
from .types import (
|
|
23
|
-
CPU_MEMORY_TYPES,
|
|
24
|
-
GPU_MEMORY_TYPES,
|
|
25
|
-
SUPPORTED_MEMORY_TYPES,
|
|
26
|
-
MemoryContractAttribute,
|
|
27
|
-
MemoryType,
|
|
28
|
-
)
|
|
29
|
-
from .utils import _ensure_module, _get_device_id, _supports_dlpack
|
|
30
|
-
|
|
31
|
-
DtypeConversion = _decorators.DtypeConversion
|
|
32
|
-
SliceBySliceRuntimeParameter = _decorators.SliceBySliceRuntimeParameter
|
|
33
|
-
memory_types = _decorators.memory_types
|
|
34
|
-
wrap_dtype_preserving_callable = _decorators.wrap_dtype_preserving_callable
|
|
35
|
-
for _memory_type in MemoryType:
|
|
36
|
-
globals()[_memory_type.value] = getattr(_decorators, _memory_type.value)
|
|
37
|
-
|
|
38
|
-
__all__ = [
|
|
39
|
-
# Types
|
|
40
|
-
"MemoryType",
|
|
41
|
-
"MemoryContractAttribute",
|
|
42
|
-
"ArrayPayload",
|
|
43
|
-
"ArrayGeometry",
|
|
44
|
-
"CPU_MEMORY_TYPES",
|
|
45
|
-
"GPU_MEMORY_TYPES",
|
|
46
|
-
"SUPPORTED_MEMORY_TYPES",
|
|
47
|
-
# Converters
|
|
48
|
-
"convert_memory",
|
|
49
|
-
"detect_memory_type",
|
|
50
|
-
# Decorators
|
|
51
|
-
"memory_types",
|
|
52
|
-
"DtypeConversion",
|
|
53
|
-
"SliceBySliceRuntimeParameter",
|
|
54
|
-
"wrap_dtype_preserving_callable",
|
|
55
|
-
# Stack utilities
|
|
56
|
-
"stack_slices",
|
|
57
|
-
"unstack_slices",
|
|
58
|
-
# Slice processing
|
|
59
|
-
"process_slices",
|
|
60
|
-
# GPU cleanup
|
|
61
|
-
"cleanup_all_gpu_frameworks",
|
|
62
|
-
# Exceptions
|
|
63
|
-
"MemoryConversionError",
|
|
64
|
-
# Scaling
|
|
65
|
-
"SCALING_FUNCTIONS",
|
|
66
|
-
# Framework config (internal but needed by some consumers)
|
|
67
|
-
"_FRAMEWORK_CONFIG",
|
|
68
|
-
"_FRAMEWORK_OPS",
|
|
69
|
-
# OOM recovery
|
|
70
|
-
"_execute_with_oom_recovery",
|
|
71
|
-
# Utils
|
|
72
|
-
"_ensure_module",
|
|
73
|
-
"_supports_dlpack",
|
|
74
|
-
"_get_device_id",
|
|
75
|
-
] + [memory_type.value for memory_type in MemoryType]
|
|
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
|
|
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
|
|
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
|