code: def load_or_generate_xor(
      input_dim=2,
      num_points=None,
      fname="code/experiments/data/xor",
      force_new=True,
  ):
      """
      Generate every permutation of (+/-1, ... +/-1) of size input_dim then
      XOR problem: take the XOR of every element of x as the target.
  
      Args:
          input_dim (int): Dimensionality of x
          force_new (bool): Force generation of a new dataset
          num_points (int or None): Number of datapoints to use. If None,
              use all 2**input_dim possible points.
      Returns:
          X - (num_points, input_dim) nparray
          Y - (num_points, 1) nparray
      """
      try:
          if force_new:
              raise Exception
          X = np.load(fname + "_X.npy")
          Y = np.load(fname + "_Y.npy")
      except:
          X = np.asarray(
              list(itertools.product([1, -1], repeat=input_dim))
          )
          Y = np.reshape(-X[:, 0] * X[:, 1], (2**input_dim, 1))
          if num_points is None:
              num_points = 2**input_dim
          X = X[:num_points, :]
          Y = Y[:num_points, :]
  
      np.save(fname + "_X.npy", X)
      np.save(fname + "_Y.npy", Y)
      return [X, Y]
  
file_path: elu-gelu-kernels/code/experiments/data/other_datasets.py
imports: import numpy
  import itertools
label_desc: Use image node_id 3 for calling a global function with example usage: load_or_generate_xor(input_dim, num_points, fname, force_new) and returns: list