xax 0.2.23__py3-none-any.whl → 0.3.1__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.
xax/__init__.py CHANGED
@@ -12,7 +12,7 @@ and running the update script:
12
12
  python -m scripts.update_api --inplace
13
13
  """
14
14
 
15
- __version__ = "0.2.23"
15
+ __version__ = "0.3.1"
16
16
 
17
17
  # This list shouldn't be modified by hand; instead, run the update script.
18
18
  __all__ = [
@@ -44,6 +44,7 @@ __all__ = [
44
44
  "normalize",
45
45
  "quat_to_euler",
46
46
  "quat_to_rotmat",
47
+ "quat_mul",
47
48
  "rotate_vector_by_quat",
48
49
  "rotation6d_to_rotation_matrix",
49
50
  "rotation_matrix_to_rotation6d",
@@ -225,6 +226,7 @@ NAME_MAP: dict[str, str] = {
225
226
  "normalize": "nn.geom",
226
227
  "quat_to_euler": "nn.geom",
227
228
  "quat_to_rotmat": "nn.geom",
229
+ "quat_mul": "nn.geom",
228
230
  "rotate_vector_by_quat": "nn.geom",
229
231
  "rotation6d_to_rotation_matrix": "nn.geom",
230
232
  "rotation_matrix_to_rotation6d": "nn.geom",
@@ -398,6 +400,7 @@ if IMPORT_ALL or TYPE_CHECKING:
398
400
  euler_to_quat,
399
401
  get_projected_gravity_vector_from_quat,
400
402
  normalize,
403
+ quat_mul,
401
404
  quat_to_euler,
402
405
  quat_to_rotmat,
403
406
  rotate_vector_by_quat,
xax/nn/geom.py CHANGED
@@ -251,3 +251,24 @@ def rotation_matrix_to_rotation6d(rotation_matrix: jnp.ndarray) -> jnp.ndarray:
251
251
  # Simply concatenate a1 and a2 from SO(3)
252
252
  r6d = jnp.concatenate([rotation_matrix[..., 0], rotation_matrix[..., 1]], axis=-1)
253
253
  return r6d.reshape(shape[:-2] + (6,))
254
+
255
+
256
+ def quat_mul(q2: Array, q1: Array) -> Array:
257
+ """Multiply two quaternions (supports batching).
258
+
259
+ Args:
260
+ q2: Second quaternion (w, x, y, z), shape (..., 4)
261
+ q1: First quaternion (w, x, y, z), shape (..., 4)
262
+
263
+ Returns:
264
+ Product quaternion, shape (..., 4)
265
+ """
266
+ w1, x1, y1, z1 = jnp.split(q1, 4, axis=-1)
267
+ w2, x2, y2, z2 = jnp.split(q2, 4, axis=-1)
268
+
269
+ w = w2 * w1 - x2 * x1 - y2 * y1 - z2 * z1
270
+ x = w2 * x1 + x2 * w1 + y2 * z1 - z2 * y1
271
+ y = w2 * y1 - x2 * z1 + y2 * w1 + z2 * x1
272
+ z = w2 * z1 + x2 * y1 - y2 * x1 + z2 * w1
273
+
274
+ return jnp.concatenate([w, x, y, z], axis=-1)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xax
3
- Version: 0.2.23
3
+ Version: 0.3.1
4
4
  Summary: A library for fast Jax experimentation
5
5
  Home-page: https://github.com/kscalelabs/xax
6
6
  Author: Benjamin Bolte
@@ -1,4 +1,4 @@
1
- xax/__init__.py,sha256=Q0boKxPtEUiiJ9j7Cdx51bLLFtYx3fPfCTG-o8o2Chk,15653
1
+ xax/__init__.py,sha256=Ku51ccrDjxWuSCgmHHVnTXhloyA_d9A1VlEEbO0Ycjg,15713
2
2
  xax/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  xax/requirements-dev.txt,sha256=qkscNkFzWd1S5fump-AKH53rR65v2x5FmboFdy_kKvs,128
4
4
  xax/requirements.txt,sha256=6qY-84e-sTmlfJNrSjwONQKqzAn5h8G_oGIhnhmfSr4,302
@@ -11,7 +11,7 @@ xax/nn/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  xax/nn/attention.py,sha256=0essK90OO3x9FxnUqU0DhufwXKRMN41zMtRCki5iKzQ,24742
12
12
  xax/nn/embeddings.py,sha256=bQGxBFxkLwi2MQLkRfGaHPH5P_KKB21HdI7VNWTKIOQ,11847
13
13
  xax/nn/functions.py,sha256=bA5kJYzMtFM8eUqBC086i355zJMAO7k_vPFNSDBI9-s,2814
14
- xax/nn/geom.py,sha256=A7WPefMvgwUNReZC7_HX1GmvHPASyghbaXaKsuhwDrE,7382
14
+ xax/nn/geom.py,sha256=7_cUeoJIfCS_YbQ6O7zElnpYsAn4XrVm4m7PaT9UcYw,8005
15
15
  xax/nn/losses.py,sha256=Q_NVnm5n4UPBvp5nI_1aUptfXnqFYoUeFwySiyvopHg,272
16
16
  xax/nn/metrics.py,sha256=zuvPXlRQczBTLHD4ilNGmZaiq6Yie3rxCMq6JkI_kos,3154
17
17
  xax/nn/parallel.py,sha256=fnTiT7MsG7eQrJvqwjIz2Ifo3P27TuxIJzmpGYSa_dQ,4608
@@ -59,9 +59,9 @@ xax/utils/data/collate.py,sha256=Rd9vMomr_S_zCa_Hi4dO-8ntzAfVwndIUtuXFA3iNcc,706
59
59
  xax/utils/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
60
  xax/utils/types/frozen_dict.py,sha256=ebtHENhyUzSjyJTlbMaLtcckQIJ7EtgJiok_40TJZpo,4689
61
61
  xax/utils/types/hashable_array.py,sha256=l5iIcFmkYzfGeaZmcSoeFkthFASqM8xJYK3AXhZQYwc,992
62
- xax-0.2.23.dist-info/licenses/LICENSE,sha256=HCN2bImAzUOXldAZZI7JZ9PYq6OwMlDAP_PpX1HnuN0,1071
63
- xax-0.2.23.dist-info/METADATA,sha256=mA98vsIjdfb8XM2mN1vUb2VRVEPU4xf10IWLxxFJjmY,1247
64
- xax-0.2.23.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
65
- xax-0.2.23.dist-info/entry_points.txt,sha256=uRC6rx5ce0bf-FblJaZSBMxxKFfMyoWTf8OWbBmLSe8,61
66
- xax-0.2.23.dist-info/top_level.txt,sha256=g4Au_r2XhvZ-lTybviH-Fh9g0zF4DAYHYxPue1-xbs8,4
67
- xax-0.2.23.dist-info/RECORD,,
62
+ xax-0.3.1.dist-info/licenses/LICENSE,sha256=HCN2bImAzUOXldAZZI7JZ9PYq6OwMlDAP_PpX1HnuN0,1071
63
+ xax-0.3.1.dist-info/METADATA,sha256=xAwDUWNoga60_KZ_nPEXrdAuvlak-zWAXk3lE-XvLeI,1246
64
+ xax-0.3.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
65
+ xax-0.3.1.dist-info/entry_points.txt,sha256=uRC6rx5ce0bf-FblJaZSBMxxKFfMyoWTf8OWbBmLSe8,61
66
+ xax-0.3.1.dist-info/top_level.txt,sha256=g4Au_r2XhvZ-lTybviH-Fh9g0zF4DAYHYxPue1-xbs8,4
67
+ xax-0.3.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.7.1)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5