Search
⚙️

einops-tricks

Squeeze first dimension (batch dimension, in most case)

rearrange(x, '() ... -> ...')
Python
복사

Unsqueeze first dimension (make dummy batch dimension)

rearrange(x, '... -> () ...')
Python
복사

Squeeze last dimension

rearrange(x, '... () -> ...')
Python
복사

Unsqueeze last dimension

rearrange(x, '... -> ... ()')
Python
복사