code: def uniform_grid(
      minimums,
      maximums,
      sizes,
      dtype=None,
      validate_args=False,
      name=None,
  ):
      """Creates a grid spec for a uniform grid.
  
      A uniform grid is characterized by having a constant gap between neighboring
      points along each axis.
  
      Note that the shape of all three parameters must be fully defined and equal
      to each other. The shape is used to determine the dimension of the grid.
  
      Args:
        minimums: Real `Tensor` of rank 1 containing the lower end points of the
          grid. Must have the same shape as those of `maximums` and `sizes` args.
        maximums: `Tensor` of the same dtype and shape as `minimums`. The upper
          endpoints of the grid.
        sizes: Integer `Tensor` of the same shape as `minimums`. The size of the
          grid in each axis. Each entry must be greater than or equal to 2 (i.e. the
          sizes include the end points). For example, if minimums = [0.] and
          maximums = [1.] and sizes = [3], the grid will have three points at [0.0,
          0.5, 1.0].
        dtype: Optional tf.dtype. The default dtype to use for the grid.
        validate_args: Python boolean indicating whether to validate the supplied
          arguments. The validation checks performed are (a) `maximums` > `minimums`
          (b) `sizes` >= 2.
        name: Python str. The name prefixed to the ops created by this function. If
          not supplied, the default name 'uniform_grid_spec' 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 the shape of maximums, minimums and sizes are not fully
        defined or they are not identical to each other or they are not rank 1.
      """
      with tf.compat.v1.name_scope(
          name, "uniform_grid", [minimums, maximums, sizes]
      ):
          minimums = tf.convert_to_tensor(
              minimums, dtype=dtype, name="minimums"
          )
          maximums = tf.convert_to_tensor(
              maximums, dtype=dtype, name="maximums"
          )
          sizes = tf.convert_to_tensor(sizes, name="sizes")
          # Check that the shape of `sizes` is statically defined.
          if not _check_shapes_fully_defined(minimums, maximums, sizes):
              raise ValueError(
                  "The shapes of minimums, maximums and sizes "
                  "must be fully defined."
              )
  
          if not (
              minimums.shape == maximums.shape
              and minimums.shape == sizes.shape
          ):
              raise ValueError(
                  "The shapes of minimums, maximums and sizes must be "
                  "identical."
              )
  
          if len(minimums.shape.as_list()) != 1:
              raise ValueError(
                  "The minimums, maximums and sizes must all be rank 1."
              )
  
          control_deps = []
          if validate_args:
              control_deps = [
                  tf.compat.v1.debugging.assert_greater(
                      maximums, minimums
                  ),
                  tf.compat.v1.debugging.assert_greater_equal(sizes, 2),
              ]
          with tf.compat.v1.control_dependencies(control_deps):
              dim = sizes.shape[0]
              locations = [
                  tf.linspace(minimums[i], maximums[i], num=sizes[i])
                  for i in range(dim)
              ]
              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 1 for calling a global function with example usage: uniform_grid(minimums, maximums, sizes, dtype, validate_args, name) and returns: locations