code: def load_or_generate_hypersphere(
      num_points,
      input_dim,
      fname="code/experiments/data/hypersphere.npy",
      force_new=True,
  ):
      """
      Choose two orthogonal vectors in input_dim space. Then, travel around the
      hypersphere in input_dim space on the circle defined by the two vectors,
      returning num_points evenly spaced points on this circle.
  
      Args:
          num_points (int): number of uniformly spaced points on the hypersphere.
          input_dim (int): Dimensionality of x and x'
          force_new (bool): Force generation of a new dataset
      Returns:
          (num_points, input_dim) nparray
      """
      try:
          if force_new:
              raise Exception
          out = np.load(fname)
      except:
          A = np.random.normal(size=(input_dim, 2))
          # q contains the two orthogonal vectors
          q, _ = np.linalg.qr(A)
  
          theta_list = np.linspace(10e-3, 2 * np.pi - 10e-3, num_points)
          out = np.empty((num_points, input_dim))
          theta_list = list(theta_list)
  
          for theta in theta_list:
              v = np.asarray([[np.cos(theta)], [np.sin(theta)]])
              x = np.transpose(np.matmul(q, v))
              out[theta_list.index(theta), :] = x
          np.save(fname, out)
      return out
  
file_path: elu-gelu-kernels/code/experiments/data/other_datasets.py
imports: import numpy
  import itertools
label_desc: Use image node_id 2 for calling a global function with example usage: load_or_generate_hypersphere(num_points, input_dim, fname, force_new) and returns: out