code: def _rotate_half(x: Tensor) -> Tensor:
      """Change sign so the last dimension becomes [-odd, +even]
  
      Args:
          x (Tensor): Input tensor
  
      Returns:
          Tensor: Tensor rotated half
      """
  
      x1, x2 = torch.chunk(x, 2, dim=-1)
      return torch.cat((-x2, x1), dim=-1)
  
file_path: megatron-lm/megatron/core/models/common/embeddings/rotary_pos_embedding.py
imports: from __future__ import annotations
  from typing import TYPE_CHECKING
  import torch
  from torch import Tensor, nn
  from megatron.core import parallel_state
label_desc: Use image node_id 2 for calling a global function with example usage: _rotate_half(x) and returns: torch