lucid-dl 2.7.7__py3-none-any.whl → 2.7.8__py3-none-any.whl

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.
lucid/_tensor/tensor.py CHANGED
@@ -397,28 +397,33 @@ class Tensor(_TensorBase):
397
397
  return hash(id(self))
398
398
 
399
399
  def __deepcopy__(self, *args: Any) -> Self:
400
+ cls = self.__class__
400
401
  copied_data = Tensor.copy_data(self.data)
401
402
 
402
- new_tensor = Tensor(
403
- copied_data,
404
- requires_grad=self.requires_grad,
405
- keep_grad=self.keep_grad,
406
- dtype=self.dtype,
407
- device=self.device,
408
- )
403
+ if cls is Tensor:
404
+ new = Tensor(
405
+ copied_data, self.requires_grad, self.keep_grad, self.dtype, self.device
406
+ )
407
+ else:
408
+ base = Tensor(copied_data, dtype=self.dtype, device=self.device)
409
+ new = cls(base)
409
410
 
410
- if self.grad is not None:
411
- new_tensor.grad = Tensor.copy_grad(self.grad)
411
+ if self.grad is not None and (
412
+ self.keep_grad or getattr(new, "keep_grad", False)
413
+ ):
414
+ new.grad = Tensor.copy_grad(self.grad)
415
+ else:
416
+ new.grad = None
412
417
 
413
- new_tensor._op = self._op
414
- new_tensor._backward_op = self._backward_op
415
- new_tensor._prev = self._prev.copy()
416
- new_tensor._backward_hooks = self._backward_hooks.copy()
418
+ new._op = None
419
+ new._backward_op = _noop
420
+ new._prev = []
421
+ new._backward_hooks = []
417
422
 
418
- new_tensor._is_free = self._is_free
419
- new_tensor._is_bool_tensor = self._is_bool_tensor
423
+ new._is_free = self._is_free
424
+ new._is_bool_tensor = self._is_bool_tensor
420
425
 
421
- return new_tensor
426
+ return new
422
427
 
423
428
  def __bool__(self) -> bool:
424
429
  if self.data.size != 1:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lucid-dl
3
- Version: 2.7.7
3
+ Version: 2.7.8
4
4
  Summary: Lumerico's Comprehensive Interface for Deep Learning
5
5
  Home-page: https://github.com/ChanLumerico/lucid
6
6
  Author: ChanLumerico
@@ -46,6 +46,12 @@ Whether you're a student, educator, or an advanced researcher seeking to demysti
46
46
 
47
47
  - Now supports [**`Safetensors`**](https://github.com/huggingface/safetensors) for Lucid neural module porting along with the legacy `.lcd` format
48
48
 
49
+ - Added multiple `nn` utilities:
50
+
51
+ - `nn.util.grad_norm` - Returns the global norm of the gradients
52
+ - `nn.util.clip_grad_norm` - Rescales the gradients based on the global norm
53
+ - `nn.util.clip_grad_value` - Rescales the gradients based on their values.
54
+
49
55
  - Implemented **EfficientDet**: `lucid.models.EfficientDet` with variants from `D0` to `D7`
50
56
 
51
57
  ## 🔧 How to Install
@@ -10,7 +10,7 @@ lucid/_func/bfunc.py,sha256=OEgtBWFL2S46UTtNU93ekYCe37Pj4oS8MEnJt-rcids,20571
10
10
  lucid/_func/gfunc.py,sha256=_gEJnYnAYhcN6aV1Z6ArIOGTgd0NEB2_eM86tE6uq-Q,4866
11
11
  lucid/_func/ufunc.py,sha256=OucEx6QdXzO2_y8Xie8Deh5IC7wnt2EIQcgCAJraWqs,30425
12
12
  lucid/_tensor/__init__.py,sha256=wFWAMhTnQwThNiBEIT4fcw4ryIm8A4AoR-m9KDhklOQ,40
13
- lucid/_tensor/tensor.py,sha256=GnoJzsaDg_nL9pBHTiaID-JwlUaLvNgRcC9O0QGTqLQ,13717
13
+ lucid/_tensor/tensor.py,sha256=HSpV9XUpMI79gw1vlmuoGh7Bkl3qFR_4alOjoq4Lq70,13819
14
14
  lucid/_tensor/tensor_ops.py,sha256=5XtqcPbrkOb87pVTSOMNaje9K78tgLpsNdV8XXnbpHc,3991
15
15
  lucid/_util/__init__.py,sha256=NgOleItHJGVLdJlKHKfpzuSl3vofzJpNsZByHAYJmKs,6838
16
16
  lucid/_util/func.py,sha256=jPpjDw-pdK9bw2U3ACEtgCbV47j6Dp9ycbkvkHKefJo,44383
@@ -120,8 +120,8 @@ lucid/visual/__init__.py,sha256=6TuFDfmXTwpLyHl7_KqBfdzW6zqHjGzIFvymjFPlvjI,21
120
120
  lucid/visual/graph.py,sha256=YjpIDM_lloZARw3sCBiXPl_hT5A2gTk2fEHvwvJWXTk,4599
121
121
  lucid/weights/__init__.py,sha256=z1AikA3rOEeckWGkYWlcZkxNlJo9Xwa39PL6ly3hWnc,8801
122
122
  lucid/weights/__init__.pyi,sha256=lFonYC3cUx2Idolf3AEPnjFcyqcn3UDU84oJlZafqLY,3013
123
- lucid_dl-2.7.7.dist-info/licenses/LICENSE,sha256=vxRFYnVD1IeYtsvw-KmoElfqrjxKHv1h9YTvsG54loQ,1065
124
- lucid_dl-2.7.7.dist-info/METADATA,sha256=UVi3p93MdqSoYHvUkdil5C12wx5sfZy5Obw4Hkd7pxs,11260
125
- lucid_dl-2.7.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
126
- lucid_dl-2.7.7.dist-info/top_level.txt,sha256=uzP_qBx9iNWIHKJRlElYcBLYVqMpdm9Q1Ma63QPYbFc,6
127
- lucid_dl-2.7.7.dist-info/RECORD,,
123
+ lucid_dl-2.7.8.dist-info/licenses/LICENSE,sha256=vxRFYnVD1IeYtsvw-KmoElfqrjxKHv1h9YTvsG54loQ,1065
124
+ lucid_dl-2.7.8.dist-info/METADATA,sha256=t8DZ8085SXcg8SH2ibdQH5K9zq2toJ3B4qwm-SpLkAk,11519
125
+ lucid_dl-2.7.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
126
+ lucid_dl-2.7.8.dist-info/top_level.txt,sha256=uzP_qBx9iNWIHKJRlElYcBLYVqMpdm9Q1Ma63QPYbFc,6
127
+ lucid_dl-2.7.8.dist-info/RECORD,,