tf_quant_finance.math.pde.grids.rectangular_grid

Last updated: 2023-03-16.

tf_quant_finance.math.pde.grids.rectangular_grid#

View source

Specifies parameters for an axis-wise non-uniform grid in n-dimensions.

tf_quant_finance.math.pde.grids.rectangular_grid(
    axis_locations, dtype=None, name=None
)

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 Tensors. The number of Tensors 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.