squarenet 1.3.2__tar.gz → 1.3.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.
- {squarenet-1.3.2 → squarenet-1.3.3}/PKG-INFO +1 -1
- {squarenet-1.3.2 → squarenet-1.3.3}/pyproject.toml +1 -1
- {squarenet-1.3.2 → squarenet-1.3.3}/src/squarenet/__init__.py +1 -1
- {squarenet-1.3.2 → squarenet-1.3.3}/src/squarenet/artist.py +6 -0
- {squarenet-1.3.2 → squarenet-1.3.3}/src/squarenet/utils.py +24 -10
- {squarenet-1.3.2 → squarenet-1.3.3}/src/squarenet.egg-info/PKG-INFO +1 -1
- {squarenet-1.3.2 → squarenet-1.3.3}/README.md +0 -0
- {squarenet-1.3.2 → squarenet-1.3.3}/setup.cfg +0 -0
- {squarenet-1.3.2 → squarenet-1.3.3}/src/squarenet/core.py +0 -0
- {squarenet-1.3.2 → squarenet-1.3.3}/src/squarenet/data/__init__.py +0 -0
- {squarenet-1.3.2 → squarenet-1.3.3}/src/squarenet/neighbormap.py +0 -0
- {squarenet-1.3.2 → squarenet-1.3.3}/src/squarenet/optim/core_numpy.py +0 -0
- {squarenet-1.3.2 → squarenet-1.3.3}/src/squarenet/optim/core_torch.py +0 -0
- {squarenet-1.3.2 → squarenet-1.3.3}/src/squarenet/optim/numpy/booster.py +0 -0
- {squarenet-1.3.2 → squarenet-1.3.3}/src/squarenet/optim/numpy/hashtable.py +0 -0
- {squarenet-1.3.2 → squarenet-1.3.3}/src/squarenet/optim/numpy/subgrid.py +0 -0
- {squarenet-1.3.2 → squarenet-1.3.3}/src/squarenet/optim/torch/booster.py +0 -0
- {squarenet-1.3.2 → squarenet-1.3.3}/src/squarenet/optim/torch/hashtable.py +0 -0
- {squarenet-1.3.2 → squarenet-1.3.3}/src/squarenet/optim/torch/subgrid.py +0 -0
- {squarenet-1.3.2 → squarenet-1.3.3}/src/squarenet/sampler.py +0 -0
- {squarenet-1.3.2 → squarenet-1.3.3}/src/squarenet/squarenet.py +0 -0
- {squarenet-1.3.2 → squarenet-1.3.3}/src/squarenet/views.py +0 -0
- {squarenet-1.3.2 → squarenet-1.3.3}/src/squarenet.egg-info/SOURCES.txt +0 -0
- {squarenet-1.3.2 → squarenet-1.3.3}/src/squarenet.egg-info/dependency_links.txt +0 -0
- {squarenet-1.3.2 → squarenet-1.3.3}/src/squarenet.egg-info/requires.txt +0 -0
- {squarenet-1.3.2 → squarenet-1.3.3}/src/squarenet.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: squarenet
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.3
|
|
4
4
|
Summary: Gridification for point clouds in any dimension (fast greedy optimal transport through Cartesian Sort).
|
|
5
5
|
Author-email: ArmanddeCacqueray <armanddecacqueray@sfr.fr>
|
|
6
6
|
Project-URL: Homepage, https://github.com/ArmanddeCacqueray/SquareNet
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "squarenet"
|
|
7
|
-
version = "1.3.
|
|
7
|
+
version = "1.3.3"
|
|
8
8
|
description = "Gridification for point clouds in any dimension (fast greedy optimal transport through Cartesian Sort)."
|
|
9
9
|
authors = [{ name = "ArmanddeCacqueray", email = "armanddecacqueray@sfr.fr" }]
|
|
10
10
|
readme = "README.md"
|
|
@@ -492,6 +492,12 @@ def sqplot(grid, verbose, style="checkerboard", animate=False,
|
|
|
492
492
|
print(f"ffmpeg unavailable. Npoints = {rounded} and style is 'scatter' -> could take 1/2 minutes")
|
|
493
493
|
else:
|
|
494
494
|
print(f"ffmpeg unavailable. Npoints = {rounded} -> could take 20/30 seconds")
|
|
495
|
+
if has_ffmpeg:
|
|
496
|
+
# On force le codec h264 qui est lu partout
|
|
497
|
+
from matplotlib.animation import FFMpegWriter
|
|
498
|
+
writer = FFMpegWriter(fps=full_cfg["fps"], codec="h264", bitrate=-1)
|
|
499
|
+
else:
|
|
500
|
+
writer = "pillow"
|
|
495
501
|
ani.save(save_path, writer=writer, fps=full_cfg["fps"])
|
|
496
502
|
else:
|
|
497
503
|
if cfg["show"]:
|
|
@@ -229,7 +229,7 @@ def from_backend(x):
|
|
|
229
229
|
# 3. JAX arrays or any object with __array__ protocol (Pandas, etc.)
|
|
230
230
|
return np.asarray(x)
|
|
231
231
|
|
|
232
|
-
def to_backend(x, backend="numpy", device="
|
|
232
|
+
def to_backend(x, backend="numpy", device="auto", warnings_=True):
|
|
233
233
|
"""
|
|
234
234
|
Convert arrays/tensors between Numpy, Torch, and JAX.
|
|
235
235
|
Utilizes DLPack for zero-copy transfers across frameworks when possible.
|
|
@@ -248,16 +248,27 @@ def to_backend(x, backend="numpy", device="cpu", warnings_=True):
|
|
|
248
248
|
# ---------------------------------------------------------
|
|
249
249
|
elif backend == "torch":
|
|
250
250
|
import torch
|
|
251
|
-
|
|
251
|
+
|
|
252
|
+
# Gestion du device 'auto'
|
|
253
|
+
if device == "auto":
|
|
254
|
+
if in_type == "torch":
|
|
255
|
+
tgt_dev = x.device
|
|
256
|
+
else:
|
|
257
|
+
# Automatiquement CUDA si dispo, sinon CPU
|
|
258
|
+
tgt_dev = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
259
|
+
else:
|
|
260
|
+
tgt_dev = torch.device(device)
|
|
252
261
|
|
|
253
262
|
if in_type == "torch":
|
|
254
|
-
if warnings_ and x.device.type != "cpu" and tgt_dev.type == "cpu":
|
|
263
|
+
if warnings_ and device != "auto" and x.device.type != "cpu" and tgt_dev.type == "cpu":
|
|
255
264
|
warn("Downgrading tensor: initial device was GPU but asked for CPU.")
|
|
256
265
|
return x.to(tgt_dev)
|
|
257
266
|
|
|
258
267
|
elif in_type in ["jax", "jaxlib"]:
|
|
259
268
|
# Zero-copy JAX to Torch via DLPack
|
|
260
|
-
|
|
269
|
+
t = torch.from_dlpack(x)
|
|
270
|
+
# En mode auto, on conserve l'appareil d'origine préservé par DLPack
|
|
271
|
+
return t if device == "auto" else t.to(tgt_dev)
|
|
261
272
|
|
|
262
273
|
return torch.as_tensor(x, device=tgt_dev)
|
|
263
274
|
|
|
@@ -268,12 +279,15 @@ def to_backend(x, backend="numpy", device="cpu", warnings_=True):
|
|
|
268
279
|
import jax
|
|
269
280
|
import jax.numpy as jnp
|
|
270
281
|
|
|
271
|
-
#
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
282
|
+
# Gestion du device 'auto'
|
|
283
|
+
if device == "auto":
|
|
284
|
+
tgt_dev = None # JAX et DLPack gèrent automatiquement le placement optimal/par défaut
|
|
285
|
+
else:
|
|
286
|
+
dev_str = "cpu" if "cpu" in str(device) else "gpu"
|
|
287
|
+
try:
|
|
288
|
+
tgt_dev = jax.devices(dev_str)[0]
|
|
289
|
+
except RuntimeError:
|
|
290
|
+
tgt_dev = None
|
|
277
291
|
|
|
278
292
|
if in_type == "torch":
|
|
279
293
|
import torch.utils.dlpack
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: squarenet
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.3
|
|
4
4
|
Summary: Gridification for point clouds in any dimension (fast greedy optimal transport through Cartesian Sort).
|
|
5
5
|
Author-email: ArmanddeCacqueray <armanddecacqueray@sfr.fr>
|
|
6
6
|
Project-URL: Homepage, https://github.com/ArmanddeCacqueray/SquareNet
|
|
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
|