DepthTensor 2.2.0__tar.gz → 2.2.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.
Files changed (25) hide show
  1. {depthtensor-2.2.0/src/DepthTensor.egg-info → depthtensor-2.2.1}/PKG-INFO +1 -1
  2. {depthtensor-2.2.0 → depthtensor-2.2.1}/pyproject.toml +1 -1
  3. {depthtensor-2.2.0 → depthtensor-2.2.1}/src/DepthTensor/__init__.py +1 -1
  4. {depthtensor-2.2.0 → depthtensor-2.2.1}/src/DepthTensor/tensor.py +33 -0
  5. {depthtensor-2.2.0 → depthtensor-2.2.1/src/DepthTensor.egg-info}/PKG-INFO +1 -1
  6. {depthtensor-2.2.0 → depthtensor-2.2.1}/LICENSE +0 -0
  7. {depthtensor-2.2.0 → depthtensor-2.2.1}/README.md +0 -0
  8. {depthtensor-2.2.0 → depthtensor-2.2.1}/setup.cfg +0 -0
  9. {depthtensor-2.2.0 → depthtensor-2.2.1}/src/DepthTensor/_core/__init__.py +0 -0
  10. {depthtensor-2.2.0 → depthtensor-2.2.1}/src/DepthTensor/_core/exceptions.py +0 -0
  11. {depthtensor-2.2.0 → depthtensor-2.2.1}/src/DepthTensor/_core/ops/__init__.py +0 -0
  12. {depthtensor-2.2.0 → depthtensor-2.2.1}/src/DepthTensor/_core/ops/comparison.py +0 -0
  13. {depthtensor-2.2.0 → depthtensor-2.2.1}/src/DepthTensor/_core/ops/creation.py +0 -0
  14. {depthtensor-2.2.0 → depthtensor-2.2.1}/src/DepthTensor/_core/ops/diff.py +0 -0
  15. {depthtensor-2.2.0 → depthtensor-2.2.1}/src/DepthTensor/_core/ops/elementwise.py +0 -0
  16. {depthtensor-2.2.0 → depthtensor-2.2.1}/src/DepthTensor/_core/ops/reduction.py +0 -0
  17. {depthtensor-2.2.0 → depthtensor-2.2.1}/src/DepthTensor/_core/random/__init__.py +0 -0
  18. {depthtensor-2.2.0 → depthtensor-2.2.1}/src/DepthTensor/_core/random/generator.py +0 -0
  19. {depthtensor-2.2.0 → depthtensor-2.2.1}/src/DepthTensor/_core/utils.py +0 -0
  20. {depthtensor-2.2.0 → depthtensor-2.2.1}/src/DepthTensor/autodiff.py +0 -0
  21. {depthtensor-2.2.0 → depthtensor-2.2.1}/src/DepthTensor/typing.py +0 -0
  22. {depthtensor-2.2.0 → depthtensor-2.2.1}/src/DepthTensor.egg-info/SOURCES.txt +0 -0
  23. {depthtensor-2.2.0 → depthtensor-2.2.1}/src/DepthTensor.egg-info/dependency_links.txt +0 -0
  24. {depthtensor-2.2.0 → depthtensor-2.2.1}/src/DepthTensor.egg-info/requires.txt +0 -0
  25. {depthtensor-2.2.0 → depthtensor-2.2.1}/src/DepthTensor.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: DepthTensor
3
- Version: 2.2.0
3
+ Version: 2.2.1
4
4
  Description-Content-Type: text/markdown
5
5
  License-File: LICENSE
6
6
  Requires-Dist: numpy
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "DepthTensor"
7
- version = "2.2.0"
7
+ version = "2.2.1"
8
8
  readme = "README.md"
9
9
  dependencies = [
10
10
  "numpy"
@@ -6,4 +6,4 @@ from ._core.ops import *
6
6
  from ._core.exceptions import *
7
7
  from ._core import random
8
8
 
9
- __version__ = "2.2.0"
9
+ __version__ = "2.2.1"
@@ -235,6 +235,11 @@ class Tensor:
235
235
  return self.copy()
236
236
  else:
237
237
  if in_place:
238
+ if self.requires_grad:
239
+ raise RuntimeError(
240
+ "In-place operations (device switch) are forbidden on differentiable tensors."
241
+ )
242
+
238
243
  self.device = device
239
244
  self.prev = () if clear_prev else self.prev
240
245
  self.data = xp_array_to_device(self.data, device=device)
@@ -400,6 +405,10 @@ class Tensor:
400
405
  )
401
406
 
402
407
  def __iadd__(self, t: OperandLike) -> Tensor:
408
+ if self.requires_grad:
409
+ raise RuntimeError(
410
+ "In-place operations are forbidden on differentiable tensors."
411
+ )
403
412
  return add(self, t, in_place=True)
404
413
 
405
414
  def __sub__(self, t: OperandLike) -> Tensor:
@@ -413,6 +422,10 @@ class Tensor:
413
422
  )
414
423
 
415
424
  def __isub__(self, t: OperandLike) -> Tensor:
425
+ if self.requires_grad:
426
+ raise RuntimeError(
427
+ "In-place operations are forbidden on differentiable tensors."
428
+ )
416
429
  return subtract(self, t, in_place=True)
417
430
 
418
431
  def __mul__(self, t: OperandLike) -> Tensor:
@@ -426,6 +439,10 @@ class Tensor:
426
439
  )
427
440
 
428
441
  def __imul__(self, t: OperandLike) -> Tensor:
442
+ if self.requires_grad:
443
+ raise RuntimeError(
444
+ "In-place operations are forbidden on differentiable tensors."
445
+ )
429
446
  return multiply(self, t, in_place=True)
430
447
 
431
448
  def __matmul__(self, t: OperandLike) -> Tensor:
@@ -439,6 +456,10 @@ class Tensor:
439
456
  )
440
457
 
441
458
  def __imatmul__(self, t: OperandLike) -> Tensor:
459
+ if self.requires_grad:
460
+ raise RuntimeError(
461
+ "In-place operations are forbidden on differentiable tensors."
462
+ )
442
463
  return matmul(self, t, in_place=True)
443
464
 
444
465
  def __truediv__(self, t: OperandLike) -> Tensor:
@@ -452,6 +473,10 @@ class Tensor:
452
473
  )
453
474
 
454
475
  def __itruediv__(self, t: OperandLike) -> Tensor:
476
+ if self.requires_grad:
477
+ raise RuntimeError(
478
+ "In-place operations are forbidden on differentiable tensors."
479
+ )
455
480
  return divide(self, t, in_place=True)
456
481
 
457
482
  def __pow__(self, t: OperandLike) -> Tensor:
@@ -460,6 +485,10 @@ class Tensor:
460
485
  )
461
486
 
462
487
  def __ipow__(self, t: OperandLike) -> Tensor:
488
+ if self.requires_grad:
489
+ raise RuntimeError(
490
+ "In-place operations are forbidden on differentiable tensors."
491
+ )
463
492
  return power(self, t, in_place=True)
464
493
 
465
494
  ###
@@ -495,6 +524,10 @@ class Tensor:
495
524
  return self.data[index]
496
525
 
497
526
  def __setitem__(self, index, value) -> Any:
527
+ if self.requires_grad:
528
+ raise RuntimeError(
529
+ "In-place operations (indexing) are forbidden on differentiable tensors."
530
+ )
498
531
  self.data[index] = value
499
532
 
500
533
  def __iter__(self) -> Iterator:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: DepthTensor
3
- Version: 2.2.0
3
+ Version: 2.2.1
4
4
  Description-Content-Type: text/markdown
5
5
  License-File: LICENSE
6
6
  Requires-Dist: numpy
File without changes
File without changes
File without changes