imt-ring 1.6.30__py3-none-any.whl → 1.6.32__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- {imt_ring-1.6.30.dist-info → imt_ring-1.6.32.dist-info}/METADATA +1 -1
- {imt_ring-1.6.30.dist-info → imt_ring-1.6.32.dist-info}/RECORD +6 -6
- ring/algorithms/jcalc.py +19 -4
- ring/utils/dataloader_torch.py +25 -1
- {imt_ring-1.6.30.dist-info → imt_ring-1.6.32.dist-info}/WHEEL +0 -0
- {imt_ring-1.6.30.dist-info → imt_ring-1.6.32.dist-info}/top_level.txt +0 -0
@@ -6,7 +6,7 @@ ring/spatial.py,sha256=nmZ-UhRanhyM34bez8uCS4wMwaKqLkuEbgKGP5XNH60,2351
|
|
6
6
|
ring/algorithms/__init__.py,sha256=IiK9EN5Xgs3dB075-A-H-Yad0Z7vzvKIJF2g6X_-C_8,1224
|
7
7
|
ring/algorithms/_random.py,sha256=UMyv-VPZLcErrKqs0XB83QJjs8GrmoNsv-zRSxGXvnI,14490
|
8
8
|
ring/algorithms/dynamics.py,sha256=dpe-F3Yq4sY2dY6DQW3v7TnPLRdxdkePtdbGPQIrijg,10997
|
9
|
-
ring/algorithms/jcalc.py,sha256=
|
9
|
+
ring/algorithms/jcalc.py,sha256=QafnCKa1mjEl7nL_KuadPJB5ebW31NKnkdcKn2YtSsM,36171
|
10
10
|
ring/algorithms/kinematics.py,sha256=DOboHI517Vx0pRJUFZtZPmK_qFaiKiQe-37B-M0aC-c,7422
|
11
11
|
ring/algorithms/sensors.py,sha256=0xOzdQIc1kBF0CkoPXWWCx3MmV4SG3wj7knVnnMWq9M,18124
|
12
12
|
ring/algorithms/custom_joints/__init__.py,sha256=3pQ-Is_HBTQDkzESCNg9VfoP8wvseWmooryG8ERnu_A,366
|
@@ -78,7 +78,7 @@ ring/utils/backend.py,sha256=cKSi9sB59texqKzNVASTDczGKLCBL8VVDiP7TNdj41k,1294
|
|
78
78
|
ring/utils/batchsize.py,sha256=FbOii7MDP4oPZd9GJOKehFatfnb6WZ0b9z349iZYs1A,1786
|
79
79
|
ring/utils/colab.py,sha256=ZLHwP0jNQUsmZJU4l68a5djULPi6T-jYNNHevjIoMn8,1631
|
80
80
|
ring/utils/dataloader.py,sha256=2CcsbUY2AZs8LraS5HTJXlEseuF-1gKmfyBkSsib-tE,3748
|
81
|
-
ring/utils/dataloader_torch.py,sha256=
|
81
|
+
ring/utils/dataloader_torch.py,sha256=wMKJ-eCJ4cHjisGODOZgDVG2r-XQjSANBQFfC05wpzo,2092
|
82
82
|
ring/utils/hdf5.py,sha256=BzXwVypZmEZeHVgeGZ78YYdi10NEQtnPhdrb8dQAXo0,5856
|
83
83
|
ring/utils/normalizer.py,sha256=67L2BU1MRsMT4pD41ta3JJMppLN0ozFmnwrmXDtnqrQ,1698
|
84
84
|
ring/utils/path.py,sha256=zRPfxYNesvgefkddd26oar6f9433LkMGkhp9dF3rPUs,1926
|
@@ -86,7 +86,7 @@ ring/utils/randomize_sys.py,sha256=G_vBIo0OwQkXL2u0djwbaoaeb02C4LQCTNNloOYIU2M,3
|
|
86
86
|
ring/utils/utils.py,sha256=tJaWXLGOTwkxJQj2l23dX97wO3aZYhM2qd7eNuMRs84,6907
|
87
87
|
ring/utils/register_gym_envs/__init__.py,sha256=PtPIRBQJ16339xZ9G9VpvqrvcGbQ_Pk_SUz4tQPa9nQ,94
|
88
88
|
ring/utils/register_gym_envs/saddle.py,sha256=tA5CyW_akSXyDm0xJ83CtOrUMVElH0f9vZtEDDJQalI,4422
|
89
|
-
imt_ring-1.6.
|
90
|
-
imt_ring-1.6.
|
91
|
-
imt_ring-1.6.
|
92
|
-
imt_ring-1.6.
|
89
|
+
imt_ring-1.6.32.dist-info/METADATA,sha256=6bNRA4bhdmUOnqV8ZfR-tl5wbk-awzTE7qmLzDOI1xs,4251
|
90
|
+
imt_ring-1.6.32.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
91
|
+
imt_ring-1.6.32.dist-info/top_level.txt,sha256=EiT790-lAyi8iwTzJArH3f2k77rwhDn00q-4PlmvDQo,5
|
92
|
+
imt_ring-1.6.32.dist-info/RECORD,,
|
ring/algorithms/jcalc.py
CHANGED
@@ -412,6 +412,9 @@ def _find_interval(t: jax.Array, boundaries: jax.Array):
|
|
412
412
|
def join_motionconfigs(
|
413
413
|
configs: list[MotionConfig], boundaries: list[float]
|
414
414
|
) -> MotionConfig:
|
415
|
+
# to avoid a circular import due to `ring.utils.randomize_sys` importing `jcalc`
|
416
|
+
from ring.utils import tree_equal
|
417
|
+
|
415
418
|
assert len(configs) == (
|
416
419
|
len(boundaries) + 1
|
417
420
|
), "length of `boundaries` should be one less than length of `configs`"
|
@@ -434,10 +437,22 @@ def join_motionconfigs(
|
|
434
437
|
time_independent_fields = [key for key in attrs if not is_time_dependent_field(key)]
|
435
438
|
|
436
439
|
for time_dep_field in time_independent_fields:
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
440
|
+
try:
|
441
|
+
field_values = set([getattr(config, time_dep_field) for config in configs])
|
442
|
+
assert (
|
443
|
+
len(field_values) == 1
|
444
|
+
), f"MotionConfig.{time_dep_field}={field_values}. "
|
445
|
+
"Should be one unique value.."
|
446
|
+
except (
|
447
|
+
TypeError
|
448
|
+
): # dict is not hashable so test equality of all elements differently
|
449
|
+
comparison_ele = getattr(configs[0], time_dep_field)
|
450
|
+
for other_config in configs[1:]:
|
451
|
+
other_ele = getattr(other_config, time_dep_field)
|
452
|
+
assert tree_equal(
|
453
|
+
comparison_ele, other_ele
|
454
|
+
), f"MotionConfig.{time_dep_field} with {comparison_ele} != {other_ele}"
|
455
|
+
" Should be one unique value.."
|
441
456
|
|
442
457
|
changes = {field: new_value(field) for field in time_dependent_fields}
|
443
458
|
return replace(configs[0], **changes)
|
ring/utils/dataloader_torch.py
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
import os
|
2
|
+
from typing import Optional
|
3
|
+
import warnings
|
2
4
|
|
3
5
|
import jax
|
4
6
|
import torch
|
@@ -35,15 +37,20 @@ def dataset_to_generator(
|
|
35
37
|
batch_size: int,
|
36
38
|
shuffle=True,
|
37
39
|
seed: int = 1,
|
40
|
+
num_workers: Optional[int] = None,
|
38
41
|
**kwargs,
|
39
42
|
):
|
40
43
|
torch.manual_seed(seed)
|
41
44
|
|
45
|
+
if num_workers is None:
|
46
|
+
num_workers = _get_number_of_logical_cores()
|
47
|
+
|
42
48
|
dl = DataLoader(
|
43
49
|
dataset,
|
44
50
|
batch_size=batch_size,
|
45
51
|
shuffle=shuffle,
|
46
|
-
multiprocessing_context="spawn" if
|
52
|
+
multiprocessing_context="spawn" if num_workers > 0 else None,
|
53
|
+
num_workers=num_workers,
|
47
54
|
**kwargs,
|
48
55
|
)
|
49
56
|
dl_iter = iter(dl)
|
@@ -60,3 +67,20 @@ def dataset_to_generator(
|
|
60
67
|
return to_numpy(next(dl_iter))
|
61
68
|
|
62
69
|
return generator
|
70
|
+
|
71
|
+
|
72
|
+
def _get_number_of_logical_cores() -> int:
|
73
|
+
N = None
|
74
|
+
if hasattr(os, "sched_getaffinity"):
|
75
|
+
try:
|
76
|
+
N = len(os.sched_getaffinity(0))
|
77
|
+
except Exception:
|
78
|
+
pass
|
79
|
+
if N is None:
|
80
|
+
N = os.cpu_count()
|
81
|
+
if N is None:
|
82
|
+
warnings.warn(
|
83
|
+
"Could not automatically set the `num_workers` variable, defaults to `0`"
|
84
|
+
)
|
85
|
+
N = 0
|
86
|
+
return N
|
File without changes
|
File without changes
|