code: def duplicate_interleave(m):
      """
      A simple version of `torch.repeat_interleave` for duplicating a matrix while interleaving the copy.
      """
      dim0 = m.shape[0]
      m = m.view(-1, 1)  # flatten the matrix
      m = m.repeat(1, 2)  # repeat all elements into the 2nd dimension
      m = m.view(
          dim0, -1
      )  # reshape into a matrix, interleaving the copy
      return m
  
file_path: NeMo/nemo/collections/nlp/modules/common/megatron/position_embedding/xpos_position_embedding.py
imports: import torch
  import torch.nn
  from einops import rearrange
  from nemo.utils.decorators import experimental
label_desc: Use image node_id 3 for calling a global function with example usage: duplicate_interleave(m) and returns: m