code: def rotate_half(x):
      x = rearrange(x, "... (j d) -> ... j d", j=2)
      x1, x2 = x.unbind(dim=-2)
      return torch.cat((-x2, x1), dim=-1)
  
imports: import torch
  import torch.nn.functional
  from einops import rearrange
  from torch import matmul, nn
label_desc: Use image node_id 1 for calling a global function with example usage: rotate_half(x) and returns: torch