code: def precompute_freqs_cis(
      dim: int, end: int, theta: float = 10000.0
  ) -> Tensor:
      freqs = 1.0 / (
          theta
          ** (
              Tensor.arange(0, dim, 2, dtype=dtypes.half)[: (dim // 2)]
              / dim
          )
      )
      freqs = Tensor.arange(end).unsqueeze(dim=1) * freqs.unsqueeze(
          dim=0
      )
      return Tensor.stack(
          [Tensor.cos(freqs), Tensor.sin(freqs)], dim=-1
      ).reshape(1, end, 1, dim // 2, 2)
  
imports: from typing import Tuple, Union, Optional, Dict
  from tinygrad import Tensor, Variable, TinyJit, dtypes, nn, Device
  from tinygrad.helpers import getenv
label_desc: Use image node_id 1 for calling a global function with example usage: precompute_freqs_cis(dim, end, theta) and returns: Tensor