DepthTensor 2.4.1__tar.gz → 2.4.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.
- {depthtensor-2.4.1 → depthtensor-2.4.3}/PKG-INFO +1 -1
- {depthtensor-2.4.1 → depthtensor-2.4.3}/pyproject.toml +3 -3
- {depthtensor-2.4.1 → depthtensor-2.4.3}/src/DepthTensor/__init__.py +1 -1
- {depthtensor-2.4.1 → depthtensor-2.4.3}/src/DepthTensor/_core/ops/elementwise.py +5 -5
- {depthtensor-2.4.1 → depthtensor-2.4.3}/src/DepthTensor/_core/ops/reduction.py +6 -3
- {depthtensor-2.4.1 → depthtensor-2.4.3}/src/DepthTensor/autodiff.py +7 -0
- {depthtensor-2.4.1 → depthtensor-2.4.3}/src/DepthTensor/typing.py +7 -2
- {depthtensor-2.4.1 → depthtensor-2.4.3}/src/depthtensor.egg-info/PKG-INFO +1 -1
- {depthtensor-2.4.1 → depthtensor-2.4.3}/LICENSE +0 -0
- {depthtensor-2.4.1 → depthtensor-2.4.3}/README.md +0 -0
- {depthtensor-2.4.1 → depthtensor-2.4.3}/setup.cfg +0 -0
- {depthtensor-2.4.1 → depthtensor-2.4.3}/src/DepthTensor/_core/__init__.py +0 -0
- {depthtensor-2.4.1 → depthtensor-2.4.3}/src/DepthTensor/_core/exceptions.py +0 -0
- {depthtensor-2.4.1 → depthtensor-2.4.3}/src/DepthTensor/_core/ops/__init__.py +0 -0
- {depthtensor-2.4.1 → depthtensor-2.4.3}/src/DepthTensor/_core/ops/comparison.py +0 -0
- {depthtensor-2.4.1 → depthtensor-2.4.3}/src/DepthTensor/_core/ops/creation.py +0 -0
- {depthtensor-2.4.1 → depthtensor-2.4.3}/src/DepthTensor/_core/ops/diff.py +0 -0
- {depthtensor-2.4.1 → depthtensor-2.4.3}/src/DepthTensor/_core/random/__init__.py +0 -0
- {depthtensor-2.4.1 → depthtensor-2.4.3}/src/DepthTensor/_core/random/generator.py +0 -0
- {depthtensor-2.4.1 → depthtensor-2.4.3}/src/DepthTensor/_core/utils.py +0 -0
- {depthtensor-2.4.1 → depthtensor-2.4.3}/src/DepthTensor/tensor.py +0 -0
- {depthtensor-2.4.1 → depthtensor-2.4.3}/src/depthtensor.egg-info/SOURCES.txt +0 -0
- {depthtensor-2.4.1 → depthtensor-2.4.3}/src/depthtensor.egg-info/dependency_links.txt +0 -0
- {depthtensor-2.4.1 → depthtensor-2.4.3}/src/depthtensor.egg-info/requires.txt +0 -0
- {depthtensor-2.4.1 → depthtensor-2.4.3}/src/depthtensor.egg-info/top_level.txt +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "depthtensor"
|
|
7
|
-
version = "2.4.
|
|
7
|
+
version = "2.4.3"
|
|
8
8
|
description = "A Hardware-Accelerated Tensor Computation and Autograd Engine"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [
|
|
@@ -13,8 +13,8 @@ authors = [
|
|
|
13
13
|
license = { file = "LICENSE" }
|
|
14
14
|
classifiers = [
|
|
15
15
|
"Programming Language :: Python :: 3",
|
|
16
|
-
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
17
|
-
"License :: OSI Approved :: MIT License",
|
|
16
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
18
|
"Operating System :: OS Independent"
|
|
19
19
|
]
|
|
20
20
|
requires-python = ">=3.8"
|
|
@@ -105,17 +105,17 @@ def create_2in_1out(op: BinaryOp, diff: BinaryDiff | None) -> BinaryFunc:
|
|
|
105
105
|
if y.requires_grad:
|
|
106
106
|
if y.grad is None:
|
|
107
107
|
y.zeros_grad()
|
|
108
|
-
dx1, dx2 = diff(y, a1, a2, **kwds)
|
|
108
|
+
dx1, dx2 = diff(y, a1, a2, device=op_device, **kwds)
|
|
109
109
|
|
|
110
110
|
def backward() -> None:
|
|
111
111
|
if isinstance(x1, Tensor) and x1.requires_grad:
|
|
112
112
|
if x1.grad is None:
|
|
113
113
|
x1.zeros_grad()
|
|
114
|
-
x1.grad +=
|
|
114
|
+
x1.grad += dx1() # type: ignore (y.grad cannot be None)
|
|
115
115
|
if isinstance(x2, Tensor) and x2.requires_grad:
|
|
116
116
|
if x2.grad is None:
|
|
117
117
|
x2.zeros_grad()
|
|
118
|
-
x2.grad +=
|
|
118
|
+
x2.grad += dx2() # type: ignore (y.grad cannot be None)
|
|
119
119
|
|
|
120
120
|
y.backward = backward
|
|
121
121
|
return y
|
|
@@ -171,13 +171,13 @@ def create_1in_1out(op: UnaryOp, diff: UnaryDiff | None) -> UnaryFunc:
|
|
|
171
171
|
if y.requires_grad:
|
|
172
172
|
if y.grad is None:
|
|
173
173
|
y.zeros_grad()
|
|
174
|
-
dx = diff(y, a, **kwds)
|
|
174
|
+
dx = diff(y, a, device=device_op, **kwds)
|
|
175
175
|
|
|
176
176
|
def backward() -> None:
|
|
177
177
|
if isinstance(x, Tensor) and x.requires_grad:
|
|
178
178
|
if x.grad is None:
|
|
179
179
|
x.zeros_grad()
|
|
180
|
-
x.grad +=
|
|
180
|
+
x.grad += dx() # type: ignore (y.grad cannot be None)
|
|
181
181
|
|
|
182
182
|
y.backward = backward
|
|
183
183
|
return y
|
|
@@ -90,9 +90,12 @@ def max(
|
|
|
90
90
|
|
|
91
91
|
arr = to_tensordata(a, device=device_op)
|
|
92
92
|
if device_op == "cpu":
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
kwargs = {"axis": axis, "out": out, "keepdims": keepdims, "where": where}
|
|
94
|
+
|
|
95
|
+
if initial is not _NoValue:
|
|
96
|
+
kwargs["initial"] = initial
|
|
97
|
+
|
|
98
|
+
y = np.max(arr, **kwargs)
|
|
96
99
|
else:
|
|
97
100
|
if cp is None:
|
|
98
101
|
raise CuPyNotFound(CUPY_NOT_FOUND_MSG)
|
|
@@ -59,6 +59,13 @@ def differentiate(tensor: Tensor, grad: TensorData | None = None) -> list[Tensor
|
|
|
59
59
|
if grad is not None:
|
|
60
60
|
_grad_check(grad, tensor)
|
|
61
61
|
tensor.grad += grad
|
|
62
|
+
else:
|
|
63
|
+
if tensor.device == "gpu":
|
|
64
|
+
if cp is None:
|
|
65
|
+
raise CuPyNotFound(CUPY_NOT_FOUND_MSG)
|
|
66
|
+
tensor.grad = cp.ones(tensor.shape, tensor.dtype)
|
|
67
|
+
elif tensor.device == "cpu":
|
|
68
|
+
tensor.grad = np.ones(tensor.shape, tensor.dtype)
|
|
62
69
|
|
|
63
70
|
for t in reversed(topo):
|
|
64
71
|
if t.backward is None:
|
|
@@ -65,7 +65,12 @@ class BinaryOp(Protocol):
|
|
|
65
65
|
|
|
66
66
|
class BinaryDiff(Protocol):
|
|
67
67
|
def __call__(
|
|
68
|
-
self,
|
|
68
|
+
self,
|
|
69
|
+
result: "Tensor",
|
|
70
|
+
x1: TensorData,
|
|
71
|
+
x2: TensorData,
|
|
72
|
+
device: Device,
|
|
73
|
+
**kwds: Any,
|
|
69
74
|
) -> tuple[Callable[[], TensorData], Callable[[], TensorData]]: ...
|
|
70
75
|
|
|
71
76
|
|
|
@@ -91,5 +96,5 @@ class UnaryOp(Protocol):
|
|
|
91
96
|
|
|
92
97
|
class UnaryDiff(Protocol):
|
|
93
98
|
def __call__(
|
|
94
|
-
self, result: "Tensor", x: TensorData, **kwds: Any
|
|
99
|
+
self, result: "Tensor", x: TensorData, device: Device, **kwds: Any
|
|
95
100
|
) -> Callable[[], TensorData]: ...
|
|
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
|