code: def rectangular_grid(axis_locations, dtype=None, name=None):
      """Specifies parameters for an axis-wise non-uniform grid in n-dimensions.
  
      This specifies rectangular grids formed by taking the cartesian product
      of points along each axis. For example, in two dimensions, one may specify
      a grid by specifying points along the x-axis as [0.0, 1.0, 1.3] and along the
      y-axis by [3.0, 3.6, 4.3, 7.0]. Taking the cartesian product of the two,
      produces a 3 x 4 grid which is rectangular but non-uniform along each axis.
  
      The points along each axis should be in ascending order and there must be at
      least two points specified along each axis. If `validate_args` is set to
      True, both these conditions are explicitly verified.
  
      Args:
        axis_locations: A Python iterable of rank 1 real `Tensor`s. The number of
          `Tensor`s in the list is the dimension of the grid. The i'th element
          specifies the coordinates of the points of the grid along that axis. Each
          `Tensor` must have at least two elements.
        dtype: Optional tf.dtype. The default dtype to use for the grid..
        name: Python str. The name prefixed to the ops created by this class. If not
          supplied, the default name 'rectangular_grid' is used.
  
      Returns:
        The grid locations as projected along each axis. One `Tensor` of shape
        `[..., n]`, where `n` is the number of points along that axis. The first
        dimensions are the batch shape. The grid itself can be seen as a cartesian
        product of the locations array.
  
      Raises:
        ValueError if `axis_locations` is empty.
      """
      with tf.compat.v1.name_scope(
          name, "rectangular_grid", [axis_locations]
      ):
          if not axis_locations:
              raise ValueError(
                  "The axis locations parameter cannot be empty."
              )
          locations = [
              tf.convert_to_tensor(
                  location,
                  dtype=dtype,
                  name="location_axis_{}".format(i),
              )
              for i, location in enumerate(axis_locations)
          ]
          return locations
  
file_path: tf-quant-finance/tf_quant_finance/math/pde/grids.py
imports: import numpy
  from six.moves import range
  import tensorflow.compat.v2
label_desc: Use image node_id 3 for calling a global function with example usage: rectangular_grid(axis_locations, dtype, name) and returns: locations