Skip to content

In lax.scan, let unroll=0 unroll the whole loop #29588

@carlosgmartin

Description

@carlosgmartin

It would be convenient to have an integer value for the unroll argument of lax.scan that unrolls the whole loop. (As opposed to the unergonomic and confusing situation of having to switch between integers and the boolean True, not to be confused with 1, which is confusingly equivalent to False.)

I argue that 0 would be a natural choice for such a value.

unroll=n splits a sequence of size k into chunks of size n followed by a chunk of size k mod n.

Thus unroll=0 should split a sequence of size k into chunks of size 0 (i.e. nothing) followed by a chunk of size k mod 0.

But k mod 0 == k. (See, e.g., here, here, here, and here.)

Therefore, unroll=0 should split a sequence into nothing followed by a chunk of size k (i.e., the whole sequence).

If this proposal is agreeable, I can create a short PR for this.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions