Skip to content

Support scalar shapes in random samplers - #9285

Merged
ooctipus merged 3 commits into
isaac-sim:mainfrom
sylvesterkaczmarek:fix/scalar-sampling-shape
Dec 1, 2026
Merged

ooctipus merged 3 commits into
isaac-sim:mainfrom
sylvesterkaczmarek:fix/scalar-sampling-shape

Conversation

@sylvesterkaczmarek

@sylvesterkaczmarek sylvesterkaczmarek commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

The uniform and triangular samplers unpack the requested shape into torch.rand. An empty tuple, which represents a scalar tensor, supplies no size argument and raises TypeError. This also affects log-uniform sampling. Pass the shape as a tuple instead.

Validation: full pre-commit checks, including changelog validation, and git diff --check pass. Manual CPU checks confirm tuple-shaped, scalar, and empty-tensor requests work with the tuple argument; unpacking an empty tuple reproduces the missing-size error. No new tests are included. The full math suite was not rerun for the test-only removal.

Release backport

  • Backport to release/3.1.0 after this pull request merges into main.

Signed-off-by: Sylvester Kaczmarek <[email protected]>
@sylvesterkaczmarek
sylvesterkaczmarek requested a review from a team November 28, 2026 15:21
@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Nov 28, 2026
@greptile-apps

greptile-apps Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Fixes scalar sampling by passing size directly to torch.rand.

  • Uniform, triangular, and log-uniform samplers return scalar tensors for empty shapes.

Reviews (1) · Last reviewed commit: "Support scalar shapes in random samplers" · Reviewed by Greptile

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isaac Lab Review Bot

Needs attention: Scope and over-engineering (1), Style consistency (1), Test quality (1). Other reviewed categories look good.

  • PR description: The title, failure explanation, changelog, and reported 15 CPU cases match the final diff; validation is reported rather than independently verified, and no performance claim requires measurements.
  • Design and architecture: Architecture looks good.
  • Scope and over-engineering: Minimal implementation: keep both changed draws in math.py and the changelog; merge test_scalar_sampling.py into existing test_math.py and delete the separate test module to avoid another CI process; no source modules were added, and the essential flow remains direct sampling with owner-boundary regression coverage; Scope is cohesive; no split recommended.
  • API: API changes look good.
  • Compatibility and deprecation: No breaking changes identified.
  • Implementation: Implementation looks good.
  • Style consistency: Both added test functions lack contribution-guide-required parameter and return annotations; annotate sampler and size parameters and add -> None.
  • Test quality: The CPU-only regression cases lack kitless routing and therefore miss that CI selection; add explicit pytest.mark.kitless markers while retaining distinct shape and fixed-bound contracts.

Minor fixes needed. Posted 3 inline findings.

Automated review; human maintainers own approval decisions.

@ooctipus

ooctipus commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

thanks for the pr :D

@ooctipus ooctipus added the ci:run-docker Trigger the on-demand Docker and GPU CI workflow label Dec 1, 2026
@sylvesterkaczmarek

Copy link
Copy Markdown
Contributor Author

Thanks for the review and for keeping the patch small! I checked the latest head: your commit removes the added test cases, so the earlier test placement, annotations and kitless findings no longer apply. The four red package summaries in run 46762479590 all report RESULT: cancelled; a replacement run is underway. I have left your changes intact.

@ooctipus
ooctipus merged commit dec7cef into isaac-sim:main Dec 1, 2026
103 of 133 checks passed
@sylvesterkaczmarek
sylvesterkaczmarek deleted the fix/scalar-sampling-shape branch December 2, 2026 15:46
kellyguo11 pushed a commit to kellyguo11/IsaacLab-public that referenced this pull request Dec 3, 2026
The uniform and triangular samplers unpack the requested shape into
torch.rand. An empty tuple, which represents a scalar tensor, supplies
no size argument and raises TypeError. This also affects log-uniform
sampling. Pass the shape as a tuple instead.

Validation: full pre-commit checks, including changelog validation, and
`git diff --check` pass. Manual CPU checks confirm tuple-shaped, scalar,
and empty-tensor requests work with the tuple argument; unpacking an
empty tuple reproduces the missing-size error. No new tests are
included. The full math suite was not rerun for the test-only removal.

## Release backport

- [ ] <!-- backport-active-release --> Backport to `release/3.1.0` after
this pull request merges into `main`.

---------

Signed-off-by: Sylvester Kaczmarek <[email protected]>
Co-authored-by: Octi Zhang <[email protected]>
(cherry picked from commit dec7cef)
kellyguo11 added a commit that referenced this pull request Dec 3, 2026
…ion (#9368)

## Description

Backport fourteen merged PRs to `release/3.1.0`:

| Original PR | Change |
| --- | --- |
| #9359 | Let CI recover after Warp and OVRTX cache eviction; allow
cold-cache demo startup. |
| #9292 | Detect UTF-8 and BOM-marked UTF-16 YAML input and write UTF-8
independently of the system locale. |
| #9346 | Update the Isaac Sim CI image digest to `6745f1725c9b`. |
| #9334 | Bind cloned deformable state and materials in clone-plan
environment order. |
| #9172 | Update and pin setup-uv and cache actions in performance CI. |
| #9062 | Resolve ray-caster mounts through shared frame views and fix
Kuka-Allegro camera mounts and missed-ray clipping. |
| #9247 | Use floating-point digital-filter coefficients when
configuration literals are integers. |
| #9285 | Support scalar shapes in uniform, triangular, and log-uniform
random sampling. |
| #9333 | Initialize OVPhysX physics consumers and joint-wrench bindings
before deferred render cloning. |
| #9366 | Add the success-guided reset sampling paper citation to the
NIST package docstring. |
| #9369 | Mark ARM64 OptiX rendering tests as expected failures without
starting the unsupported runtime. |
| #9365 | Fix documented GR00T N1.7 installation with explicit tyro and
Git LFS/source-override handling. |
| #9270 | Upgrade Newton, MuJoCo/MuJoCo Warp 4.1, Warp 1.20, USD
schemas, and LEAPP, with required runtime and converter compatibility
changes. |
| #9317 | Preserve convex-hull collider types when constructing the
implicit MPM solver. |

Cherry-picked with `-x`, preserving one commit per source PR. The first
six were applied in merge order (#9334, #9062, #9292, #9359, #9346,
#9172), followed by #9247, #9285, #9333, #9366, #9369, #9365, #9270, and
#9317. All fourteen applied without conflicts or manual edits. Every
stable patch ID matches its original merge commit. Original
documentation, regression tests, and changelog fragments are preserved.

### Compatibility

These are the original PRs in full, including their compatibility
changes and version markers:

- #9292: legacy locale-encoded YAML must be converted to UTF-8.
- #9062: ray casters require an existing mount frame; the old
Newton/OVPhysX synthetic mounting behavior is removed. The shared
FrameView transform API is added. Kuka-Allegro missed rays now clip at
2.5 m, changing observations seen by previously trained policies.
- #9333: removes unreleased internal binding-event plumbing; public
`PhysicsEvent.PHYSICS_READY` subscriptions and callback priorities
remain supported. This includes the lifecycle changes from the original
PR.

- #9270: upgrades core dependencies and includes breaking API removals.
Actuators use `command_interface` / `command_interface_state` and
`drive`; Newton sensors use solver observables. Removed options include
`MujocoCollisionCfg.solmix`, `MJWarpSolverCfg.update_data_interval` /
`ls_parallel`, and `KaminoPADMMCfg.compl_tolerance`;
`soft_contact_margin` becomes `soft_contact_gap`. Native MuJoCo CPU
simulation requires one world. The temporary MJCF converter patch and
original migration documentation are included. ARM OptiX requires an
R590+ driver; #9369 retains the expected failure on current ARM CI.

## Type of change

- Release backport: bug fixes, dependency upgrades, compatibility
changes, CI updates, tests, and documentation.

## Validation

Latest combined head: `1a2304c75`. The branch includes a merge of
release tip `7cfe2659f` in `9f60679bc`; existing changes from that merge
are preserved.

### Final combined-head checks

- Full repository formatting/lint, changelog validation against
`upstream/release/3.1.0`, and `git diff --check upstream/release/3.1.0`
passed at `1a2304c75`.
- #9317 applied without conflicts and its stable patch ID matches the
original. Its required Newton revision
`838ddf544927333559af894dfba0edb1a9efba04` is already locked through
#9270.
- Focused MPM tests were attempted with `uv run --no-sync python -m
pytest source/isaaclab_newton/test/physics/test_newton_solvers.py -k mpm
-q`; collection is blocked by the missing `isaaclab_newton` installation
in this macOS environment. The CUDA regression requires
supported-platform CI.

### Earlier thirteen-backport checks

- Full repository formatting/lint passed:
`ISAACLAB_CHANGELOG_BASE_REF=upstream/release/3.1.0 uv run --no-sync
isaaclab --format`.
- Changelog validation against `upstream/release/3.1.0` and `git diff
--check upstream/release/3.1.0` passed.
- #9270 applied without conflicts and its stable patch ID matches the
original. Its original dependency lock, wheel overrides, runtime
adaptations, tests, golden image, and changelog fragments are preserved.
- Root dependency metadata: **13 passed**; wheel-builder metadata: **14
passed**, using `uv run --no-sync python -m pytest` on the corresponding
CLI test files.
- Reset-state buffers: **7 passed, 1 skipped** in the existing macOS
environment. This environment still has Warp **1.17.0**, so this result
does not validate the new Warp 1.20 runtime.
- Confirmed the lock selects Warp 1.20.0, MuJoCo/MuJoCo Warp 4.1.0,
Newton USD schemas 0.8.0, and Newton revision
`838ddf544927333559af894dfba0edb1a9efba04`.
- Updated dependency installation, GPU simulation/rendering, and a clean
docs build remain unvalidated locally. Earlier runtime test results
below predate #9270 and do not establish compatibility with the upgraded
dependencies.

### Earlier twelve-backport checks

- Full repository formatting/lint, changelog validation against
`upstream/release/3.1.0`, and `git diff --check upstream/release/3.1.0`
passed at `26293b3bc`.
- #9365 applied without conflicts and its stable patch ID matches the
original. It changes only the GR00T installation documentation;
`pyproject.toml` and `uv.lock` are unchanged by this cherry-pick.
- The updated installation command block passed `bash -n`. External
GR00T installation and training were not rerun locally.
- Clean docs validation remains outstanding on a supported platform, as
detailed below.

### Earlier eleven-backport checks

- Full repository formatting/lint, changelog validation against
`upstream/release/3.1.0`, and `git diff --check upstream/release/3.1.0`
passed at `2a7783ebe`.
- #9369 applied without conflicts and its stable patch ID matches the
original.
- Evaluated the actual OptiX xfail decorator for `aarch64`, `arm64`,
`x86_64`, and `AMD64`: only ARM64 enables `xfail(run=False)`; Newton
Warp tests retain no xfail marker.
- GPU rendering was not rerun locally.

### Earlier ten-backport checks

The following checks passed at `97dc765f9`, before the test-marker-only
#9369 cherry-pick:

- Full repository formatting/lint checks passed:
`ISAACLAB_CHANGELOG_BASE_REF=upstream/release/3.1.0 uv run --no-sync
isaaclab --format`.
- Changelog check passed: `uv run --no-sync python
tools/changelog/cli.py check upstream/release/3.1.0 --include-worktree`.
- `git diff --check upstream/release/3.1.0` passed.
- All ten stable patch IDs match their source commits.
- Tensor processors: **13 passed**, using `uv run --no-sync python -m
pytest source/isaaclab/test/utils/test_tensor_processors.py -q`.
- Direct CPU checks passed for scalar, batched, and empty requests in
uniform, triangular, and log-uniform sampling, plus integer-coefficient
digital-filter unit-delay behavior. The scalar-sampling and
integer-coefficient bugs were reproduced before these fixes were added.
- The existing uv interpreter and imported core package were verified to
point at this checkout.

### Earlier six-backport checks

The following passed at `2afdfd8be`, before the four additional
cherry-picks, using `uv run --no-sync python -m pytest <file> -q`, one
file per process:

- YAML I/O: **8 passed**.
- Clone-plan algebra: **32 passed, 5 skipped**.
- Ray-caster kernels: **17 passed**.

### Remaining validation

- Validation used the existing uv environment on macOS because normal uv
resolution rejects this platform; the committed lockfile supports Linux
and Windows only.
- A clean docs build was attempted for the initial six-backport head
with `uv run --no-sync isaaclab --docs`; its nested uv invocation was
blocked by that platform restriction. The expanded documentation changes
still need a supported-platform build.
- GPU/OVPhysX/Newton simulation integration, including the #9333
lifecycle changes, and cold-cache demos have not been rerun locally for
this combined backport.
- No complete CI result is claimed for the latest combined head.

## Checklist

- [x] Read the contribution guidelines.
- [x] Run full repository formatting and lint checks.
- [x] Preserve original documentation, tests, and package changelog
fragments.
- [x] Verify all fourteen cherry-picks match the original patches.
- [x] Run focused locally supported checks.
- [ ] Complete clean docs and GPU integration validation on supported
platforms.

---------

Signed-off-by: Sylvester Kaczmarek <[email protected]>
Co-authored-by: ooctipus <[email protected]>
Co-authored-by: YuTeh Shen <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Sylvester Kaczmarek <[email protected]>
Co-authored-by: hujc <[email protected]>
Co-authored-by: isaaclab-bot[bot] <282401363+isaaclab-bot[bot]@users.noreply.github.com>
Co-authored-by: fanes <[email protected]>
Co-authored-by: Richard Schmitt <[email protected]>
Co-authored-by: Mateo Guaman Castro <[email protected]>
Co-authored-by: Junnosuke Kamohara <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ci:run-docker Trigger the on-demand Docker and GPU CI workflow isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants