Skip to main content

ClikaRT::ops::meshgrid

function

meshgrid()

std::vector<Tensor> meshgrid(
    ClikaRT::Span<const Tensor> tensors,
    MeshgridIndexing indexing = MeshgridIndexing::IJ
)

Coordinate grids from 1-D axes: N inputs produce N N-D tensors, each input broadcast over every other axis, the NumPy meshgrid.

With MeshgridIndexing::IJ (matrix indexing, the default) the output shapes follow the input order [len0, len1, ..]; XY (Cartesian) swaps the first two axes.

Parameters

Returns: one grid per input, all of the common output shape.

Throws

  • ClikaRT::Error: (INVALID_ARGUMENT) when an input is not 1-D (code_name() carries the reason).
auto g = ClikaRT::ops::meshgrid({ys, xs}); // g[0], g[1]: [len_y, len_x]

Declared in ClikaRT/compute/ops.h, line 3404