code: def sparse_meshgrid(*x):
      
      n = len(x)
      mesh = []
      for ax, xi in enumerate(x):
          xi = np.asarray(xi)
          slc = [None] * n
          slc[ax] = slice(None)
          mesh.append(np.ascontiguousarray(xi[tuple(slc)]))
  
      return tuple(mesh)
docs: Make a sparse `meshgrid` by adding empty dimensions.
  
      Parameters
      ----------
      x1,...,xN : `array-like`
          Input arrays to turn into sparse meshgrid vectors.
  
      Returns
      -------
      meshgrid : tuple of `numpy.ndarray`'s
          Sparse coordinate vectors representing an N-dimensional grid.
  
      See Also
      --------
      numpy.meshgrid : dense or sparse meshgrids
  
      Examples
      --------
      >>> x, y = [0, 1], [2, 3, 4]
      >>> mesh = sparse_meshgrid(x, y)
      >>> sum(xi for xi in mesh).ravel()  # first axis slowest
      array([2, 3, 4, 3, 4, 5])