Missed TensorFlow Dev Summit? Check out the video playlist. Watch recordings

tfl.test_utils.two_dim_mesh_grid

View source on GitHub

Generates uniform 2-d mesh grid for 3-d surfaces visualisation via pyplot.

tfl.test_utils.two_dim_mesh_grid(
    num_points, x_min, y_min, x_max, y_max
)

Used in the notebooks

Used in the tutorials

Uniformly distributes 'num_points' within rectangle: (x_min, y_min) - (x_max, y_max) 'num_points' should be such that uniform distribution is possible. In other words there should exist such integers 'x_points' and 'y_points' that:

  • x_points * y_points == num_points
  • x_points / y_points == (x_max - x_min) / (y_max - y_min)

Args:

  • num_points: number of points in the grid.
  • x_min: bounds of the grid.
  • y_min: bounds of the grid.
  • x_max: bounds of the grid.
  • y_max: bounds of the grid.

Returns:

Tuple containing 2 numpy arrays which represent X and Y coordinates of mesh grid

Raises:

  • ValueError: if it's impossible to uniformly distribute 'num_points' across specified grid.