Learn R Programming

torch (version 0.2.1)

torch_meshgrid: Meshgrid

Description

Meshgrid

Usage

torch_meshgrid(tensors)

Arguments

tensors

(list of Tensor) list of scalars or 1 dimensional tensors. Scalars will be treated (1,).

TEST

Take \(N\) tensors, each of which can be either scalar or 1-dimensional vector, and create \(N\) N-dimensional grids, where the \(i\) th grid is defined by expanding the \(i\) th input over dimensions defined by other inputs.

Examples

Run this code
# NOT RUN {
if (torch_is_installed()) {

x = torch_tensor(c(1, 2, 3))
y = torch_tensor(c(4, 5, 6))
out = torch_meshgrid(list(x, y))
out
}
# }

Run the code above in your browser using DataLab