code: def cosine_basis_functions(x, n_basis_functions=64):
      """Cosine basis functions used to embed quantile thresholds.
  
      Args:
          x (ndarray): Input.
          n_basis_functions (int): Number of cosine basis functions.
  
      Returns:
          ndarray: Embedding with shape of (x.shape + (n_basis_functions,)).
      """
      xp = chainer.cuda.get_array_module(x)
      # Equation (4) in the IQN paper has an error stating i=0,...,n-1.
      # Actually i=1,...,n is correct (personal communication)
      i_pi = (
          xp.arange(1, n_basis_functions + 1, dtype=xp.float32) * xp.pi
      )
      embedding = xp.cos(x[..., None] * i_pi)
      assert embedding.shape == x.shape + (n_basis_functions,)
      return embedding
  
imports: import chainer
  from chainer import cuda
  import chainer.functions
  import chainer.links
  from chainerrl.action_value import QuantileDiscreteActionValue
  from chainerrl.agents import dqn
  from chainerrl.links import StatelessRecurrentChainList
label_desc: Use image node_id 1 for calling a global function with example usage: cosine_basis_functions(x, n_basis_functions) and returns: embedding