This rule raises an issue when an incorrect pattern is provided to an einops operation.
The einops library provides a powerful and flexible way to manipulate tensors using the Einstein summation convention. The
einops uses a different convention than the traditional one. In particular, the axis names
can be more than one letter long and are separated by spaces.
Correct the syntax of the einops operation by balancing the parentheses and following the convention.
from einops import rearrange import torch x = torch.randn(2, 3, 4, 5) x2 = rearrange(x, 'b c h w -> b (c h w') # Noncompliant : the parentheses are not balanced
from einops import rearrange import torch x = torch.randn(2, 3, 4, 5) x2 = rearrange(x, 'b c h w -> b (c h w)')
einops documentation - Einops basics