code: def precompute_freqs_cis(dim: int, end: int, theta: float = 10000.0):
      """
      Precompute the frequency tensor for complex exponentials (cis) with given dimensions.
  
      This function calculates a frequency tensor with complex exponentials using the given dimension 'dim'
      and the end index 'end'. The 'theta' parameter scales the frequencies.
      The returned tensor contains complex values in complex64 data type.
  
      Args:
          dim (int): Dimension of the frequency tensor.
          end (int): End index for precomputing frequencies.
          theta (float, optional): Scaling factor for frequency computation. Defaults to 10000.0.
  
      Returns:
          torch.Tensor: Precomputed frequency tensor with complex exponentials.
  
  
  
  
      """
      freqs = 1.0 / (
          theta ** (torch.arange(0, dim, 2)[: (dim // 2)].float() / dim)
      )
      t = torch.arange(end, device=freqs.device)  # type: ignore
      freqs = torch.outer(t, freqs).float()  # type: ignore
      freqs_cis = torch.polar(
          torch.ones_like(freqs), freqs
      )  # complex64
      return freqs_cis
  
imports: import torch
  import torch.nn.functional
  from typing import Optional, Tuple
label_desc: Use image node_id 1 for calling a global function with example usage: precompute_freqs_cis(dim, end, theta) and returns: freqs_cis