Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[math] add ein_rearrange, ein_reduce, and ein_repeat functions #590

Merged
merged 4 commits into from
Jan 9, 2024

Conversation

chaoming0625
Copy link
Collaborator

Examples:

import brainpy.math as bm

# rearrange elements according to the pattern
output_tensor = bm.ein_rearrange(input_tensor, 't b c -> b c t')
# combine rearrangement and reduction
output_tensor = bm.ein_reduce(input_tensor, 'b c (h h2) (w w2) -> b h w c', 'mean', h2=2, w2=2)
# copy along a new axis
output_tensor = bm.ein_repeat(input_tensor, 'h w -> h w c', c=3)

@chaoming0625 chaoming0625 merged commit fca558f into master Jan 9, 2024
32 checks passed
@chaoming0625 chaoming0625 deleted the einops branch January 9, 2024 08:21
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