664 # cyclic shift
665 if self.shift_size > 0:
666 shifted_x = torch.roll(x, shifts=(-self.shift_size, -self.shift_size), dims=(1, 2))
667 attn_mask = attn_mask 668 else:
669 shifted_x = x
670 attn_mask = None
Variable is being assigned to itself. It is unnecessary to assign a variable to itself without any modification. You can safely remove this assignment operation.
if condition:
x = x
doSomething()
if condition:
doSomething()