#include <poplin/MeshGrid.hpp>

Functions to populate arrays with linear sequences of values.

namespace poplin

Linear algebra functions.

Decomposition of a matrix into an lower triangular matrix L and upper triangular matrix U.


poplar::Tensor linspace(poplar::Graph &graph, const poplar::Type &type, float left, float right, size_t count, const poplar::DebugContext &debugContext = {})

Create a constant variable that contains values equally spaced in the specified closed range [left, right].

  • graph – Graph to which the variable is added.

  • left – The first value in the range.

  • right – The last value in the range.

  • type – Data type of variable to create. Must be FLOAT or HALF.

  • debugContext – Optional debug information.


Constant Tensor of rank 1 (vector) containing the linspace values.

std::vector<poplar::Tensor> meshgrid2d(poplar::Graph &graph, poplar::Tensor x, poplar::Tensor y)

Create a coordinate grid for each axis by broadcasting the input tensors.

This 2D specialisation only supports two inputs that must be of rank 1 (vectors) and hence the output coordinate grids are always two matrices (so two outputs of rank 2).

  • graph – Graph to which the variables are added.

  • x – Co-ordinates for the x-axis.

  • y – Co-ordinates for the y-axis.


A list of (two) tensors that form co-ordinate grids for each input axis. These output tensors will be views of the inputs (reshaped and broadcast).