Skip to content

more efficient zipvmap implementation - #23

Closed
marcelluethi wants to merge 2 commits into
dimwit-dev:mainfrom
marcelluethi:zipvmap
Closed

more efficient zipvmap implementation#23
marcelluethi wants to merge 2 commits into
dimwit-dev:mainfrom
marcelluethi:zipvmap

Conversation

@marcelluethi

Copy link
Copy Markdown
Contributor

The current zipvmap function is implemented to work with abitrary tuple types.
As a result it could not use jax vmap function directly. This causes a very significant performance penalty.
This PR proposes to have specialised zipvmap calls for zips of 2,3 and 4 tensors, which are much more efficient.
As a fallback for more then 4 dimensions, the generic method is used.

As the specialised code is rather repetitive and long, I moved it out of the tensorops file into a dedicated module.

The interface remains the same and all the tests still pass.

@marcelluethi
marcelluethi requested a review from benikm91 January 2, 2026 14:05
@benikm91

benikm91 commented Jan 2, 2026

Copy link
Copy Markdown
Collaborator

Please see #20, in this clean up I implemented zipvmap based on vmap (for any tuple)

@marcelluethi

Copy link
Copy Markdown
Contributor Author

I just tested your implementation. It completely solves the performance problem and is more general and elegant than the solution I proposed.

I will close this PR.

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.

2 participants