depthtensor 2.4.2__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.2 → depthtensor-2.4.3}/PKG-INFO +1 -1
- {depthtensor-2.4.2 → depthtensor-2.4.3}/pyproject.toml +1 -1
- {depthtensor-2.4.2 → depthtensor-2.4.3}/src/DepthTensor/__init__.py +1 -1
- {depthtensor-2.4.2 → depthtensor-2.4.3}/src/DepthTensor/_core/ops/elementwise.py +2 -2
- {depthtensor-2.4.2 → depthtensor-2.4.3}/src/DepthTensor/_core/ops/reduction.py +6 -3
- {depthtensor-2.4.2 → depthtensor-2.4.3}/src/DepthTensor/autodiff.py +7 -0
- {depthtensor-2.4.2 → depthtensor-2.4.3}/src/DepthTensor/typing.py +7 -2
- {depthtensor-2.4.2 → depthtensor-2.4.3}/src/depthtensor.egg-info/PKG-INFO +1 -1
- {depthtensor-2.4.2 → depthtensor-2.4.3}/LICENSE +0 -0
- {depthtensor-2.4.2 → depthtensor-2.4.3}/README.md +0 -0
- {depthtensor-2.4.2 → depthtensor-2.4.3}/setup.cfg +0 -0
- {depthtensor-2.4.2 → depthtensor-2.4.3}/src/DepthTensor/_core/__init__.py +0 -0
- {depthtensor-2.4.2 → depthtensor-2.4.3}/src/DepthTensor/_core/exceptions.py +0 -0
- {depthtensor-2.4.2 → depthtensor-2.4.3}/src/DepthTensor/_core/ops/__init__.py +0 -0
- {depthtensor-2.4.2 → depthtensor-2.4.3}/src/DepthTensor/_core/ops/comparison.py +0 -0
- {depthtensor-2.4.2 → depthtensor-2.4.3}/src/DepthTensor/_core/ops/creation.py +0 -0
- {depthtensor-2.4.2 → depthtensor-2.4.3}/src/DepthTensor/_core/ops/diff.py +0 -0
- {depthtensor-2.4.2 → depthtensor-2.4.3}/src/DepthTensor/_core/random/__init__.py +0 -0
- {depthtensor-2.4.2 → depthtensor-2.4.3}/src/DepthTensor/_core/random/generator.py +0 -0
- {depthtensor-2.4.2 → depthtensor-2.4.3}/src/DepthTensor/_core/utils.py +0 -0
- {depthtensor-2.4.2 → depthtensor-2.4.3}/src/DepthTensor/tensor.py +0 -0
- {depthtensor-2.4.2 → depthtensor-2.4.3}/src/depthtensor.egg-info/SOURCES.txt +0 -0
- {depthtensor-2.4.2 → depthtensor-2.4.3}/src/depthtensor.egg-info/dependency_links.txt +0 -0
- {depthtensor-2.4.2 → depthtensor-2.4.3}/src/depthtensor.egg-info/requires.txt +0 -0
- {depthtensor-2.4.2 → depthtensor-2.4.3}/src/depthtensor.egg-info/top_level.txt +0 -0
|
@@ -105,7 +105,7 @@ 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:
|
|
@@ -171,7 +171,7 @@ 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:
|
|
@@ -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
|