code: def forward(
      ctx,
      x,
      cos,
      sin,
      interleaved=False,
      inplace=False,
      seqlen_offsets: Union[int, torch.Tensor] = 0,
      cu_seqlens: Optional[torch.Tensor] = None,
      max_seqlen: Optional[int] = None,
  ):
      out = apply_rotary(
          x,
          cos,
          sin,
          seqlen_offsets=seqlen_offsets,
          cu_seqlens=cu_seqlens,
          max_seqlen=max_seqlen,
          interleaved=interleaved,
          inplace=inplace,
      )
      if isinstance(seqlen_offsets, int):
          ctx.save_for_backward(
              cos, sin, cu_seqlens
          )  # Can't save int with save_for_backward
          ctx.seqlen_offsets = seqlen_offsets
      else:
          ctx.save_for_backward(cos, sin, cu_seqlens, seqlen_offsets)
          ctx.seqlen_offsets = None
      ctx.interleaved = interleaved
      ctx.inplace = inplace
      ctx.max_seqlen = max_seqlen
      return out if not inplace else x
  
imports: import math
  from typing import Optional, Tuple, Union
  import torch
  from einops import rearrange, repeat
  from flash_attn.ops.triton.rotary import apply_rotary
label_desc: Use image node_id 1 for calling the ApplyRotaryEmb obj's underlying member method code with example usage: obj.forward(ctx, x, cos, sin, interleaved, inplace, seqlen_offsets, cu_seqlens, max_seqlen) and returns: unknown