DepthTensor 1.2.1__tar.gz → 1.3.1__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.2.1/src/DepthTensor.egg-info → depthtensor-1.3.1}/PKG-INFO +1 -1
- {depthtensor-1.2.1 → depthtensor-1.3.1}/pyproject.toml +1 -1
- {depthtensor-1.2.1 → depthtensor-1.3.1}/src/DepthTensor/__init__.py +1 -1
- {depthtensor-1.2.1 → depthtensor-1.3.1}/src/DepthTensor/_core/ops/comparison.py +7 -7
- {depthtensor-1.2.1 → depthtensor-1.3.1}/src/DepthTensor/_core/ops/elementwise.py +17 -17
- {depthtensor-1.2.1 → depthtensor-1.3.1}/src/DepthTensor/_core/ops/reduction.py +19 -16
- {depthtensor-1.2.1 → depthtensor-1.3.1}/src/DepthTensor/_core/random/generator.py +5 -4
- {depthtensor-1.2.1 → depthtensor-1.3.1}/src/DepthTensor/autodiff.py +0 -1
- {depthtensor-1.2.1 → depthtensor-1.3.1}/src/DepthTensor/tensor.py +60 -72
- {depthtensor-1.2.1 → depthtensor-1.3.1/src/DepthTensor.egg-info}/PKG-INFO +1 -1
- depthtensor-1.3.1/src/example/example.py +4 -0
- depthtensor-1.2.1/src/example/example.py +0 -4
- {depthtensor-1.2.1 → depthtensor-1.3.1}/LICENSE +0 -0
- {depthtensor-1.2.1 → depthtensor-1.3.1}/README.md +0 -0
- {depthtensor-1.2.1 → depthtensor-1.3.1}/setup.cfg +0 -0
- {depthtensor-1.2.1 → depthtensor-1.3.1}/src/DepthTensor/_core/__init__.py +0 -0
- {depthtensor-1.2.1 → depthtensor-1.3.1}/src/DepthTensor/_core/exceptions.py +0 -0
- {depthtensor-1.2.1 → depthtensor-1.3.1}/src/DepthTensor/_core/ops/__init__.py +0 -0
- {depthtensor-1.2.1 → depthtensor-1.3.1}/src/DepthTensor/_core/ops/creation.py +0 -0
- {depthtensor-1.2.1 → depthtensor-1.3.1}/src/DepthTensor/_core/ops/diff.py +0 -0
- {depthtensor-1.2.1 → depthtensor-1.3.1}/src/DepthTensor/_core/random/__init__.py +0 -0
- {depthtensor-1.2.1 → depthtensor-1.3.1}/src/DepthTensor/_core/utils.py +0 -0
- {depthtensor-1.2.1 → depthtensor-1.3.1}/src/DepthTensor/typing.py +0 -0
- {depthtensor-1.2.1 → depthtensor-1.3.1}/src/DepthTensor.egg-info/SOURCES.txt +0 -0
- {depthtensor-1.2.1 → depthtensor-1.3.1}/src/DepthTensor.egg-info/dependency_links.txt +0 -0
- {depthtensor-1.2.1 → depthtensor-1.3.1}/src/DepthTensor.egg-info/requires.txt +0 -0
- {depthtensor-1.2.1 → depthtensor-1.3.1}/src/DepthTensor.egg-info/top_level.txt +0 -0
- {depthtensor-1.2.1 → depthtensor-1.3.1}/tests/test_tensor.py +0 -0
|
@@ -6,7 +6,6 @@ from typing import (
|
|
|
6
6
|
)
|
|
7
7
|
|
|
8
8
|
from ...typing import (
|
|
9
|
-
ArrayLike,
|
|
10
9
|
TensorLike,
|
|
11
10
|
DeviceLike,
|
|
12
11
|
ArrayLikeBool,
|
|
@@ -18,7 +17,6 @@ from ...typing import (
|
|
|
18
17
|
from ..exceptions import (
|
|
19
18
|
CuPyNotFound, CUPY_NOT_FOUND_MSG,
|
|
20
19
|
DeviceMismatch, DEVICE_MISMATCH_MSG,
|
|
21
|
-
OperandMismatch, OPERAND_MISMATCH_MSG
|
|
22
20
|
)
|
|
23
21
|
|
|
24
22
|
from ..utils import to_xp_array
|
|
@@ -101,15 +99,12 @@ def wrapper_2in_1out(
|
|
|
101
99
|
subok: bool = True
|
|
102
100
|
) -> TensorLike:
|
|
103
101
|
from ...tensor import Tensor
|
|
102
|
+
is_tensor_op = False
|
|
104
103
|
if isinstance(x1, Tensor) and isinstance(x2, Tensor):
|
|
105
104
|
if not x1.is_device(x2.device):
|
|
106
105
|
raise DeviceMismatch(DEVICE_MISMATCH_MSG)
|
|
107
106
|
else:
|
|
108
107
|
is_tensor_op = True
|
|
109
|
-
else:
|
|
110
|
-
if isinstance(x1, Tensor) or isinstance(x2, Tensor):
|
|
111
|
-
raise OperandMismatch(OPERAND_MISMATCH_MSG)
|
|
112
|
-
is_tensor_op = False
|
|
113
108
|
#* Either tensor-tensor op or array-array op.
|
|
114
109
|
|
|
115
110
|
#* If its tensor-tensor op, device is decided by x1.device, else, its by the device argument.
|
|
@@ -222,5 +217,10 @@ def less_equal(
|
|
|
222
217
|
|
|
223
218
|
__all__ = [
|
|
224
219
|
'where',
|
|
225
|
-
'equal',
|
|
220
|
+
'equal',
|
|
221
|
+
'not_equal',
|
|
222
|
+
'greater',
|
|
223
|
+
'greater_equal',
|
|
224
|
+
'less',
|
|
225
|
+
'less_equal'
|
|
226
226
|
]
|
|
@@ -17,8 +17,7 @@ from ...typing import (
|
|
|
17
17
|
|
|
18
18
|
from ..exceptions import (
|
|
19
19
|
DeviceMismatch, DEVICE_MISMATCH_MSG,
|
|
20
|
-
CuPyNotFound, CUPY_NOT_FOUND_MSG
|
|
21
|
-
OperandMismatch, OPERAND_MISMATCH_MSG
|
|
20
|
+
CuPyNotFound, CUPY_NOT_FOUND_MSG
|
|
22
21
|
)
|
|
23
22
|
|
|
24
23
|
from ..utils import (
|
|
@@ -51,15 +50,12 @@ def wrapper_2in_1out(
|
|
|
51
50
|
subok: bool = True
|
|
52
51
|
) -> TensorLike:
|
|
53
52
|
from ...tensor import Tensor
|
|
53
|
+
is_tensor_op = False
|
|
54
54
|
if isinstance(x1, Tensor) and isinstance(x2, Tensor):
|
|
55
55
|
if not x1.is_device(x2.device):
|
|
56
56
|
raise DeviceMismatch(DEVICE_MISMATCH_MSG)
|
|
57
57
|
else:
|
|
58
|
-
is_tensor_op = True
|
|
59
|
-
else:
|
|
60
|
-
if isinstance(x1, Tensor) or isinstance(x2, Tensor):
|
|
61
|
-
raise OperandMismatch(OPERAND_MISMATCH_MSG)
|
|
62
|
-
is_tensor_op = False
|
|
58
|
+
is_tensor_op = True
|
|
63
59
|
#* Either tensor-tensor op or array-array op.
|
|
64
60
|
|
|
65
61
|
#* If its tensor-tensor op, device is decided by x1.device, else, its by the device argument.
|
|
@@ -263,14 +259,11 @@ def clip(
|
|
|
263
259
|
subok: bool = True
|
|
264
260
|
) -> TensorLike:
|
|
265
261
|
from ...tensor import Tensor
|
|
262
|
+
is_tensor_op = False
|
|
266
263
|
if isinstance(a, Tensor) and isinstance(a_min, Tensor) and isinstance(a_max, Tensor):
|
|
267
264
|
if not (a.device == a_min.device == a_max.device): raise DeviceMismatch(DEVICE_MISMATCH_MSG)
|
|
268
265
|
is_tensor_op = True
|
|
269
|
-
|
|
270
|
-
if isinstance(a, Tensor) or isinstance(a_min, Tensor) or isinstance(a_max, Tensor):
|
|
271
|
-
raise OperandMismatch(OPERAND_MISMATCH_MSG)
|
|
272
|
-
is_tensor_op = False
|
|
273
|
-
|
|
266
|
+
|
|
274
267
|
if is_tensor_op and isinstance(a, Tensor):
|
|
275
268
|
device_op = a.device
|
|
276
269
|
else:
|
|
@@ -356,10 +349,17 @@ def square(
|
|
|
356
349
|
###
|
|
357
350
|
|
|
358
351
|
__all__ = [
|
|
359
|
-
'add',
|
|
360
|
-
'
|
|
361
|
-
|
|
362
|
-
'
|
|
363
|
-
|
|
352
|
+
'add',
|
|
353
|
+
'subtract',
|
|
354
|
+
'multiply',
|
|
355
|
+
'matmul',
|
|
356
|
+
'divide',
|
|
357
|
+
'negative',
|
|
358
|
+
'sign',
|
|
359
|
+
'abs',
|
|
360
|
+
'exp',
|
|
361
|
+
'sqrt',
|
|
362
|
+
'log',
|
|
363
|
+
'square',
|
|
364
364
|
'clip'
|
|
365
365
|
]
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
from typing import (
|
|
2
2
|
Optional,
|
|
3
3
|
Union,
|
|
4
|
-
Any
|
|
5
|
-
TypeVar
|
|
4
|
+
Any
|
|
6
5
|
)
|
|
7
6
|
|
|
8
7
|
from ...typing import (
|
|
@@ -14,14 +13,12 @@ from ...typing import (
|
|
|
14
13
|
DTypeLike,
|
|
15
14
|
AxisShapeLike,
|
|
16
15
|
OperandLike,
|
|
17
|
-
DeviceLike
|
|
18
|
-
ArrayLike
|
|
16
|
+
DeviceLike
|
|
19
17
|
)
|
|
20
18
|
|
|
21
19
|
from ..exceptions import (
|
|
22
20
|
CuPyNotFound, CUPY_NOT_FOUND_MSG,
|
|
23
|
-
DeviceMismatch, DEVICE_MISMATCH_MSG
|
|
24
|
-
OperandMismatch, OPERAND_MISMATCH_MSG
|
|
21
|
+
DeviceMismatch, DEVICE_MISMATCH_MSG
|
|
25
22
|
)
|
|
26
23
|
|
|
27
24
|
from ..utils import (
|
|
@@ -59,10 +56,17 @@ def sum(
|
|
|
59
56
|
|
|
60
57
|
arr = to_xp_array(a, device=device_op)
|
|
61
58
|
if device_op == "cpu":
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
kwds = {
|
|
60
|
+
'axis': axis,
|
|
61
|
+
'dtype': dtype,
|
|
62
|
+
'keepdims': keepdims,
|
|
63
|
+
'where': where
|
|
64
|
+
}
|
|
65
|
+
if not isinstance(initial, type(_NoValue)):
|
|
66
|
+
kwds['initial'] = initial
|
|
67
|
+
if out is not None:
|
|
68
|
+
kwds['out'] = out
|
|
69
|
+
y = np.sum(arr, **kwds)
|
|
66
70
|
else:
|
|
67
71
|
if cp is None: raise CuPyNotFound(CUPY_NOT_FOUND_MSG)
|
|
68
72
|
y = cp.sum(arr, axis=axis, dtype=dtype, out=out, keepdims=keepdims)
|
|
@@ -107,14 +111,11 @@ def maximum(
|
|
|
107
111
|
subok: bool = True
|
|
108
112
|
) -> TensorLike:
|
|
109
113
|
from ...tensor import Tensor
|
|
114
|
+
is_tensor_op = False
|
|
110
115
|
if isinstance(x1, Tensor) and isinstance(x2, Tensor):
|
|
111
116
|
if not x1.is_device(x2.device): raise DeviceMismatch(DEVICE_MISMATCH_MSG)
|
|
112
117
|
is_tensor_op = True
|
|
113
|
-
|
|
114
|
-
if isinstance(x1, Tensor) or isinstance(x2, Tensor):
|
|
115
|
-
raise OperandMismatch(OPERAND_MISMATCH_MSG)
|
|
116
|
-
is_tensor_op = False
|
|
117
|
-
|
|
118
|
+
|
|
118
119
|
if is_tensor_op and isinstance(x1, Tensor):
|
|
119
120
|
device_op = x1.device
|
|
120
121
|
else:
|
|
@@ -132,5 +133,7 @@ def maximum(
|
|
|
132
133
|
###
|
|
133
134
|
|
|
134
135
|
__all__ = [
|
|
135
|
-
'max',
|
|
136
|
+
'max',
|
|
137
|
+
'maximum',
|
|
138
|
+
'sum'
|
|
136
139
|
]
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
from typing import (
|
|
2
2
|
Optional,
|
|
3
3
|
overload,
|
|
4
|
-
Any
|
|
5
|
-
Type
|
|
4
|
+
Any
|
|
6
5
|
)
|
|
7
6
|
|
|
8
7
|
from numpy import random
|
|
@@ -19,7 +18,6 @@ from ..exceptions import (
|
|
|
19
18
|
CuPyNotFound, CUPY_NOT_FOUND_MSG
|
|
20
19
|
)
|
|
21
20
|
|
|
22
|
-
import numpy as np
|
|
23
21
|
try:
|
|
24
22
|
import cupy as cp
|
|
25
23
|
except (ImportError, ModuleNotFoundError):
|
|
@@ -106,5 +104,8 @@ def uniform(
|
|
|
106
104
|
###
|
|
107
105
|
|
|
108
106
|
__all__ = [
|
|
109
|
-
'rand',
|
|
107
|
+
'rand',
|
|
108
|
+
'randn',
|
|
109
|
+
'randint',
|
|
110
|
+
'uniform'
|
|
110
111
|
]
|
|
@@ -217,8 +217,8 @@ class Tensor():
|
|
|
217
217
|
|
|
218
218
|
@staticmethod
|
|
219
219
|
def subtract(
|
|
220
|
-
x1:
|
|
221
|
-
x2:
|
|
220
|
+
x1: OperandLike,
|
|
221
|
+
x2: OperandLike,
|
|
222
222
|
/,
|
|
223
223
|
out: Optional[Union[np.ndarray, Any]] = None,
|
|
224
224
|
*,
|
|
@@ -239,8 +239,8 @@ class Tensor():
|
|
|
239
239
|
|
|
240
240
|
@staticmethod
|
|
241
241
|
def multiply(
|
|
242
|
-
x1:
|
|
243
|
-
x2:
|
|
242
|
+
x1: OperandLike,
|
|
243
|
+
x2: OperandLike,
|
|
244
244
|
/,
|
|
245
245
|
out: Optional[Union[np.ndarray, Any]] = None,
|
|
246
246
|
*,
|
|
@@ -261,8 +261,8 @@ class Tensor():
|
|
|
261
261
|
|
|
262
262
|
@staticmethod
|
|
263
263
|
def matmul(
|
|
264
|
-
x1:
|
|
265
|
-
x2:
|
|
264
|
+
x1: OperandLike,
|
|
265
|
+
x2: OperandLike,
|
|
266
266
|
/,
|
|
267
267
|
out: Optional[Union[np.ndarray, Any]] = None,
|
|
268
268
|
*,
|
|
@@ -282,8 +282,8 @@ class Tensor():
|
|
|
282
282
|
|
|
283
283
|
@staticmethod
|
|
284
284
|
def divide(
|
|
285
|
-
x1:
|
|
286
|
-
x2:
|
|
285
|
+
x1: OperandLike,
|
|
286
|
+
x2: OperandLike,
|
|
287
287
|
/,
|
|
288
288
|
out: Optional[Union[np.ndarray, Any]] = None,
|
|
289
289
|
*,
|
|
@@ -304,7 +304,7 @@ class Tensor():
|
|
|
304
304
|
|
|
305
305
|
@staticmethod
|
|
306
306
|
def negative(
|
|
307
|
-
x:
|
|
307
|
+
x: OperandLike,
|
|
308
308
|
/,
|
|
309
309
|
out: Optional[Union[np.ndarray, Any]] = None,
|
|
310
310
|
*,
|
|
@@ -325,9 +325,9 @@ class Tensor():
|
|
|
325
325
|
|
|
326
326
|
@staticmethod
|
|
327
327
|
def clip(
|
|
328
|
-
a:
|
|
329
|
-
a_min:
|
|
330
|
-
a_max:
|
|
328
|
+
a: OperandLike,
|
|
329
|
+
a_min: OperandLike,
|
|
330
|
+
a_max: OperandLike,
|
|
331
331
|
/,
|
|
332
332
|
out: Optional[ArrayLike] = None,
|
|
333
333
|
*,
|
|
@@ -342,7 +342,7 @@ class Tensor():
|
|
|
342
342
|
|
|
343
343
|
@staticmethod
|
|
344
344
|
def sign(
|
|
345
|
-
x:
|
|
345
|
+
x: OperandLike,
|
|
346
346
|
/,
|
|
347
347
|
out: Optional[Union[np.ndarray, Any]] = None,
|
|
348
348
|
*,
|
|
@@ -363,7 +363,7 @@ class Tensor():
|
|
|
363
363
|
|
|
364
364
|
@staticmethod
|
|
365
365
|
def abs(
|
|
366
|
-
x:
|
|
366
|
+
x: OperandLike,
|
|
367
367
|
/,
|
|
368
368
|
out: Optional[Union[np.ndarray, Any]] = None,
|
|
369
369
|
*,
|
|
@@ -388,7 +388,7 @@ class Tensor():
|
|
|
388
388
|
|
|
389
389
|
@staticmethod
|
|
390
390
|
def exp(
|
|
391
|
-
x:
|
|
391
|
+
x: OperandLike,
|
|
392
392
|
/,
|
|
393
393
|
out: Optional[Union[np.ndarray, Any]] = None,
|
|
394
394
|
*,
|
|
@@ -409,7 +409,7 @@ class Tensor():
|
|
|
409
409
|
|
|
410
410
|
@staticmethod
|
|
411
411
|
def sqrt(
|
|
412
|
-
x:
|
|
412
|
+
x: OperandLike,
|
|
413
413
|
/,
|
|
414
414
|
out: Optional[Union[np.ndarray, Any]] = None,
|
|
415
415
|
*,
|
|
@@ -435,7 +435,7 @@ class Tensor():
|
|
|
435
435
|
@staticmethod
|
|
436
436
|
@overload
|
|
437
437
|
def where(
|
|
438
|
-
condition:
|
|
438
|
+
condition: OperandLike,
|
|
439
439
|
/,
|
|
440
440
|
*,
|
|
441
441
|
device: DeviceLike = "cpu",
|
|
@@ -444,9 +444,9 @@ class Tensor():
|
|
|
444
444
|
@staticmethod
|
|
445
445
|
@overload
|
|
446
446
|
def where(
|
|
447
|
-
condition:
|
|
448
|
-
x: Optional[
|
|
449
|
-
y: Optional[
|
|
447
|
+
condition: OperandLike,
|
|
448
|
+
x: Optional[OperandLike],
|
|
449
|
+
y: Optional[OperandLike],
|
|
450
450
|
/,
|
|
451
451
|
*,
|
|
452
452
|
device: DeviceLike = "cpu",
|
|
@@ -454,9 +454,9 @@ class Tensor():
|
|
|
454
454
|
|
|
455
455
|
@staticmethod
|
|
456
456
|
def where(
|
|
457
|
-
condition:
|
|
458
|
-
x: Optional[
|
|
459
|
-
y: Optional[
|
|
457
|
+
condition: OperandLike,
|
|
458
|
+
x: Optional[OperandLike] = None,
|
|
459
|
+
y: Optional[OperandLike] = None,
|
|
460
460
|
/,
|
|
461
461
|
*,
|
|
462
462
|
device: DeviceLike = "cpu",
|
|
@@ -474,8 +474,8 @@ class Tensor():
|
|
|
474
474
|
|
|
475
475
|
@staticmethod
|
|
476
476
|
def equal(
|
|
477
|
-
x1:
|
|
478
|
-
x2:
|
|
477
|
+
x1: OperandLike,
|
|
478
|
+
x2: OperandLike,
|
|
479
479
|
/,
|
|
480
480
|
out: Optional[ArrayLikeBool] = None,
|
|
481
481
|
*,
|
|
@@ -490,8 +490,8 @@ class Tensor():
|
|
|
490
490
|
|
|
491
491
|
@staticmethod
|
|
492
492
|
def not_equal(
|
|
493
|
-
x1:
|
|
494
|
-
x2:
|
|
493
|
+
x1: OperandLike,
|
|
494
|
+
x2: OperandLike,
|
|
495
495
|
/,
|
|
496
496
|
out: Optional[ArrayLikeBool] = None,
|
|
497
497
|
*,
|
|
@@ -506,8 +506,8 @@ class Tensor():
|
|
|
506
506
|
|
|
507
507
|
@staticmethod
|
|
508
508
|
def greater(
|
|
509
|
-
x1:
|
|
510
|
-
x2:
|
|
509
|
+
x1: OperandLike,
|
|
510
|
+
x2: OperandLike,
|
|
511
511
|
/,
|
|
512
512
|
out: Optional[ArrayLikeBool] = None,
|
|
513
513
|
*,
|
|
@@ -522,8 +522,8 @@ class Tensor():
|
|
|
522
522
|
|
|
523
523
|
@staticmethod
|
|
524
524
|
def greater_equal(
|
|
525
|
-
x1:
|
|
526
|
-
x2:
|
|
525
|
+
x1: OperandLike,
|
|
526
|
+
x2: OperandLike,
|
|
527
527
|
/,
|
|
528
528
|
out: Optional[ArrayLikeBool] = None,
|
|
529
529
|
*,
|
|
@@ -538,8 +538,8 @@ class Tensor():
|
|
|
538
538
|
|
|
539
539
|
@staticmethod
|
|
540
540
|
def less(
|
|
541
|
-
x1:
|
|
542
|
-
x2:
|
|
541
|
+
x1: OperandLike,
|
|
542
|
+
x2: OperandLike,
|
|
543
543
|
/,
|
|
544
544
|
out: Optional[ArrayLikeBool] = None,
|
|
545
545
|
*,
|
|
@@ -554,8 +554,8 @@ class Tensor():
|
|
|
554
554
|
|
|
555
555
|
@staticmethod
|
|
556
556
|
def less_equal(
|
|
557
|
-
x1:
|
|
558
|
-
x2:
|
|
557
|
+
x1: OperandLike,
|
|
558
|
+
x2: OperandLike,
|
|
559
559
|
/,
|
|
560
560
|
out: Optional[ArrayLikeBool] = None,
|
|
561
561
|
*,
|
|
@@ -574,7 +574,7 @@ class Tensor():
|
|
|
574
574
|
|
|
575
575
|
@staticmethod
|
|
576
576
|
def sum(
|
|
577
|
-
a:
|
|
577
|
+
a: OperandLike,
|
|
578
578
|
/,
|
|
579
579
|
*,
|
|
580
580
|
device: DeviceLike = "cpu",
|
|
@@ -589,7 +589,7 @@ class Tensor():
|
|
|
589
589
|
|
|
590
590
|
@staticmethod
|
|
591
591
|
def max(
|
|
592
|
-
a:
|
|
592
|
+
a: OperandLike,
|
|
593
593
|
/,
|
|
594
594
|
*,
|
|
595
595
|
device: DeviceLike = "cpu",
|
|
@@ -603,8 +603,8 @@ class Tensor():
|
|
|
603
603
|
|
|
604
604
|
@staticmethod
|
|
605
605
|
def maximum(
|
|
606
|
-
x1:
|
|
607
|
-
x2:
|
|
606
|
+
x1: OperandLike,
|
|
607
|
+
x2: OperandLike,
|
|
608
608
|
/,
|
|
609
609
|
out: Optional[np.ndarray] = None,
|
|
610
610
|
*,
|
|
@@ -621,73 +621,61 @@ class Tensor():
|
|
|
621
621
|
### Dunder Operations
|
|
622
622
|
###
|
|
623
623
|
|
|
624
|
-
def __add__(self, t:
|
|
624
|
+
def __add__(self, t: OperandLike) -> Tensor:
|
|
625
625
|
return Tensor.add(self, t)
|
|
626
|
-
def __radd__(self, t:
|
|
626
|
+
def __radd__(self, t: OperandLike) -> Tensor:
|
|
627
627
|
return Tensor.add(t, self)
|
|
628
|
-
def __iadd__(self, t:
|
|
628
|
+
def __iadd__(self, t: OperandLike) -> Tensor:
|
|
629
629
|
return Tensor.add(self, t, in_place=True)
|
|
630
630
|
|
|
631
|
-
def __sub__(self, t:
|
|
631
|
+
def __sub__(self, t: OperandLike) -> Tensor:
|
|
632
632
|
return Tensor.subtract(self, t)
|
|
633
|
-
def __rsub__(self, t:
|
|
633
|
+
def __rsub__(self, t: OperandLike) -> Tensor:
|
|
634
634
|
return Tensor.subtract(t, self)
|
|
635
|
-
def __isub__(self, t:
|
|
635
|
+
def __isub__(self, t: OperandLike) -> Tensor:
|
|
636
636
|
return Tensor.subtract(self, t, in_place=True)
|
|
637
637
|
|
|
638
|
-
def __mul__(self, t:
|
|
638
|
+
def __mul__(self, t: OperandLike) -> Tensor:
|
|
639
639
|
return Tensor.multiply(self, t)
|
|
640
|
-
def __rmul__(self, t:
|
|
640
|
+
def __rmul__(self, t: OperandLike) -> Tensor:
|
|
641
641
|
return Tensor.multiply(t, self)
|
|
642
|
-
def __imul__(self, t:
|
|
642
|
+
def __imul__(self, t: OperandLike) -> Tensor:
|
|
643
643
|
return Tensor.multiply(self, t, in_place=True)
|
|
644
644
|
|
|
645
|
-
def __matmul__(self, t:
|
|
645
|
+
def __matmul__(self, t: OperandLike) -> Tensor:
|
|
646
646
|
return Tensor.matmul(self, t)
|
|
647
|
-
def __rmatmul__(self, t:
|
|
647
|
+
def __rmatmul__(self, t: OperandLike) -> Tensor:
|
|
648
648
|
return Tensor.matmul(t, self)
|
|
649
|
-
def __imatmul__(self, t:
|
|
649
|
+
def __imatmul__(self, t: OperandLike) -> Tensor:
|
|
650
650
|
return Tensor.matmul(self, t, in_place=True)
|
|
651
651
|
|
|
652
|
-
def __truediv__(self, t:
|
|
652
|
+
def __truediv__(self, t: OperandLike) -> Tensor:
|
|
653
653
|
return Tensor.divide(self, t)
|
|
654
|
-
def __rtruediv__(self, t:
|
|
654
|
+
def __rtruediv__(self, t: OperandLike) -> Tensor:
|
|
655
655
|
return Tensor.divide(t, self)
|
|
656
|
-
def __itruediv__(self, t:
|
|
656
|
+
def __itruediv__(self, t: OperandLike) -> Tensor:
|
|
657
657
|
return Tensor.divide(self, t, in_place=True)
|
|
658
658
|
|
|
659
659
|
###
|
|
660
660
|
### Unary
|
|
661
661
|
###
|
|
662
662
|
|
|
663
|
-
def __eq__(self, value: Any) ->
|
|
664
|
-
if not isinstance(value, Tensor):
|
|
665
|
-
return NotImplemented
|
|
663
|
+
def __eq__(self, value: Any) -> Tensor: # type: ignore[override]
|
|
666
664
|
return equal(self, value)
|
|
667
665
|
|
|
668
|
-
def __ne__(self, value: Any) ->
|
|
669
|
-
if not isinstance(value, Tensor):
|
|
670
|
-
return NotImplemented
|
|
666
|
+
def __ne__(self, value: Any) -> Tensor: # type: ignore[override]
|
|
671
667
|
return not_equal(self, value)
|
|
672
668
|
|
|
673
|
-
def __gt__(self, value: Any) ->
|
|
674
|
-
if not isinstance(value, Tensor):
|
|
675
|
-
return NotImplemented
|
|
669
|
+
def __gt__(self, value: Any) -> Tensor: # type: ignore[override]
|
|
676
670
|
return greater(self, value)
|
|
677
671
|
|
|
678
|
-
def __ge__(self, value: Any) ->
|
|
679
|
-
if not isinstance(value, Tensor):
|
|
680
|
-
return NotImplemented
|
|
672
|
+
def __ge__(self, value: Any) -> Tensor: # type: ignore[override]
|
|
681
673
|
return greater_equal(self, value)
|
|
682
674
|
|
|
683
|
-
def __lt__(self, value: Any) ->
|
|
684
|
-
if not isinstance(value, Tensor):
|
|
685
|
-
return NotImplemented
|
|
675
|
+
def __lt__(self, value: Any) -> Tensor: # type: ignore[override]
|
|
686
676
|
return less(self, value)
|
|
687
677
|
|
|
688
|
-
def __le__(self, value: Any) ->
|
|
689
|
-
if not isinstance(value, Tensor):
|
|
690
|
-
return NotImplemented
|
|
678
|
+
def __le__(self, value: Any) -> Tensor: # type: ignore[override]
|
|
691
679
|
return less_equal(self, value)
|
|
692
680
|
|
|
693
681
|
def __neg__(self) -> Tensor:
|
|
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
|