DepthTensor 1.8.0__tar.gz → 1.9.0__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-1.8.0/src/DepthTensor.egg-info → depthtensor-1.9.0}/PKG-INFO +1 -1
- {depthtensor-1.8.0 → depthtensor-1.9.0}/pyproject.toml +1 -1
- {depthtensor-1.8.0 → depthtensor-1.9.0}/src/DepthTensor/__init__.py +1 -1
- {depthtensor-1.8.0 → depthtensor-1.9.0}/src/DepthTensor/_core/ops/comparison.py +8 -5
- {depthtensor-1.8.0 → depthtensor-1.9.0}/src/DepthTensor/tensor.py +4 -1
- {depthtensor-1.8.0 → depthtensor-1.9.0/src/DepthTensor.egg-info}/PKG-INFO +1 -1
- {depthtensor-1.8.0 → depthtensor-1.9.0}/LICENSE +0 -0
- {depthtensor-1.8.0 → depthtensor-1.9.0}/README.md +0 -0
- {depthtensor-1.8.0 → depthtensor-1.9.0}/setup.cfg +0 -0
- {depthtensor-1.8.0 → depthtensor-1.9.0}/src/DepthTensor/_core/__init__.py +0 -0
- {depthtensor-1.8.0 → depthtensor-1.9.0}/src/DepthTensor/_core/exceptions.py +0 -0
- {depthtensor-1.8.0 → depthtensor-1.9.0}/src/DepthTensor/_core/ops/__init__.py +0 -0
- {depthtensor-1.8.0 → depthtensor-1.9.0}/src/DepthTensor/_core/ops/creation.py +0 -0
- {depthtensor-1.8.0 → depthtensor-1.9.0}/src/DepthTensor/_core/ops/diff.py +0 -0
- {depthtensor-1.8.0 → depthtensor-1.9.0}/src/DepthTensor/_core/ops/elementwise.py +0 -0
- {depthtensor-1.8.0 → depthtensor-1.9.0}/src/DepthTensor/_core/ops/reduction.py +0 -0
- {depthtensor-1.8.0 → depthtensor-1.9.0}/src/DepthTensor/_core/random/__init__.py +0 -0
- {depthtensor-1.8.0 → depthtensor-1.9.0}/src/DepthTensor/_core/random/generator.py +0 -0
- {depthtensor-1.8.0 → depthtensor-1.9.0}/src/DepthTensor/_core/utils.py +0 -0
- {depthtensor-1.8.0 → depthtensor-1.9.0}/src/DepthTensor/autodiff.py +0 -0
- {depthtensor-1.8.0 → depthtensor-1.9.0}/src/DepthTensor/typing.py +0 -0
- {depthtensor-1.8.0 → depthtensor-1.9.0}/src/DepthTensor.egg-info/SOURCES.txt +0 -0
- {depthtensor-1.8.0 → depthtensor-1.9.0}/src/DepthTensor.egg-info/dependency_links.txt +0 -0
- {depthtensor-1.8.0 → depthtensor-1.9.0}/src/DepthTensor.egg-info/requires.txt +0 -0
- {depthtensor-1.8.0 → depthtensor-1.9.0}/src/DepthTensor.egg-info/top_level.txt +0 -0
- {depthtensor-1.8.0 → depthtensor-1.9.0}/src/example/example.py +0 -0
- {depthtensor-1.8.0 → depthtensor-1.9.0}/tests/test_tensor.py +0 -0
|
@@ -36,7 +36,8 @@ def where(
|
|
|
36
36
|
condition: OperandLike,
|
|
37
37
|
/,
|
|
38
38
|
*,
|
|
39
|
-
device: DeviceLike = "cpu"
|
|
39
|
+
device: DeviceLike = "cpu",
|
|
40
|
+
requires_grad: bool = False
|
|
40
41
|
) -> Tuple[TensorLike, ...]: ...
|
|
41
42
|
|
|
42
43
|
@overload
|
|
@@ -46,7 +47,8 @@ def where(
|
|
|
46
47
|
y: Optional[OperandLike],
|
|
47
48
|
/,
|
|
48
49
|
*,
|
|
49
|
-
device: DeviceLike = "cpu"
|
|
50
|
+
device: DeviceLike = "cpu",
|
|
51
|
+
requires_grad: bool = False
|
|
50
52
|
) -> TensorLike: ...
|
|
51
53
|
|
|
52
54
|
def where(
|
|
@@ -55,7 +57,8 @@ def where(
|
|
|
55
57
|
y: Optional[OperandLike] = None,
|
|
56
58
|
/,
|
|
57
59
|
*,
|
|
58
|
-
device: DeviceLike = "cpu"
|
|
60
|
+
device: DeviceLike = "cpu",
|
|
61
|
+
requires_grad: bool = False
|
|
59
62
|
) -> Union[Tuple[TensorLike, ...], TensorLike]:
|
|
60
63
|
from ...tensor import Tensor
|
|
61
64
|
#* One parameter overload
|
|
@@ -66,7 +69,7 @@ def where(
|
|
|
66
69
|
else:
|
|
67
70
|
if cp is None: raise CuPyNotFound(CUPY_NOT_FOUND_MSG)
|
|
68
71
|
result = cp.where(data)
|
|
69
|
-
return tuple([Tensor(array, device=device) for array in result])
|
|
72
|
+
return tuple([Tensor(array, device=device, requires_grad=requires_grad) for array in result])
|
|
70
73
|
elif x is not None and y is not None:
|
|
71
74
|
data = to_xp_array(condition, device=device)
|
|
72
75
|
x_data = to_xp_array(x, device=device)
|
|
@@ -76,7 +79,7 @@ def where(
|
|
|
76
79
|
else:
|
|
77
80
|
if cp is None: raise CuPyNotFound(CUPY_NOT_FOUND_MSG)
|
|
78
81
|
result = cp.where(data, x_data, y_data)
|
|
79
|
-
return Tensor(result, device=device)
|
|
82
|
+
return Tensor(result, device=device, requires_grad=requires_grad)
|
|
80
83
|
else:
|
|
81
84
|
raise ValueError("Both x and y parameters must be given.")
|
|
82
85
|
|
|
@@ -567,6 +567,7 @@ class Tensor():
|
|
|
567
567
|
/,
|
|
568
568
|
*,
|
|
569
569
|
device: DeviceLike = "cpu",
|
|
570
|
+
requires_grad: bool = False
|
|
570
571
|
) -> Tuple[Tensor, ...]: ...
|
|
571
572
|
|
|
572
573
|
@staticmethod
|
|
@@ -578,6 +579,7 @@ class Tensor():
|
|
|
578
579
|
/,
|
|
579
580
|
*,
|
|
580
581
|
device: DeviceLike = "cpu",
|
|
582
|
+
requires_grad: bool = False
|
|
581
583
|
) -> Tensor: ...
|
|
582
584
|
|
|
583
585
|
@staticmethod
|
|
@@ -588,6 +590,7 @@ class Tensor():
|
|
|
588
590
|
/,
|
|
589
591
|
*,
|
|
590
592
|
device: DeviceLike = "cpu",
|
|
593
|
+
requires_grad: bool = False
|
|
591
594
|
) -> Union[Tuple[Tensor, ...], Tensor]:
|
|
592
595
|
device = "cpu"
|
|
593
596
|
if isinstance(condition, Tensor):
|
|
@@ -598,7 +601,7 @@ class Tensor():
|
|
|
598
601
|
if y and isinstance(y, Tensor):
|
|
599
602
|
if y.device != device:
|
|
600
603
|
raise RuntimeError("Arguments, as tensors, must have the same device.")
|
|
601
|
-
return where(condition, x, y, device=device)
|
|
604
|
+
return where(condition, x, y, device=device, requires_grad=requires_grad)
|
|
602
605
|
|
|
603
606
|
@staticmethod
|
|
604
607
|
def equal(
|
|
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
|