Skip to content

tighten edge-case handling for reductions and shape ops#356

Open
sebffischer wants to merge 1 commit into
mainfrom
iterate-edge-cases-334
Open

tighten edge-case handling for reductions and shape ops#356
sebffischer wants to merge 1 commit into
mainfrom
iterate-edge-cases-334

Conversation

@sebffischer
Copy link
Copy Markdown
Contributor

  • All named reductions (sum, prod, max, min, any, all and derivatives like mean, var, sd) reject reducing over a zero-size axis at trace time. prim_reduce (user-supplied init) remains exempt.
  • prim_argmax / prim_argmin reject reducing over a zero-size axis; nv_argmax / nv_argmin reject 0-dimensional operands.
  • nv_diag requires a 1-D operand.
  • nv_var / nv_sd default dims = NULL (reduce all axes), matching the other reductions.
  • nv_squeeze rejects duplicate dims via assert_integerish(unique).

* All named reductions (sum, prod, max, min, any, all and derivatives
  like mean, var, sd) reject reducing over a zero-size axis at trace
  time. `prim_reduce` (user-supplied init) remains exempt.
* `prim_argmax` / `prim_argmin` reject reducing over a zero-size axis;
  `nv_argmax` / `nv_argmin` reject 0-dimensional operands.
* `nv_diag` requires a 1-D operand.
* `nv_var` / `nv_sd` default `dims = NULL` (reduce all axes), matching
  the other reductions.
* `nv_squeeze` rejects duplicate dims via `assert_integerish(unique)`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant