View source: R/gen-namespace.R
torch_meshgrid | R Documentation |
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.
torch_meshgrid(tensors, indexing)
tensors |
(list of Tensor) list of scalars or 1 dimensional tensors. Scalars will be treated (1,). |
indexing |
(str, optional): the indexing mode, either “xy” or “ij”, defaults to “ij”. See warning for future changes. If “xy” is selected, the first dimension corresponds to the cardinality of the second input and the second dimension corresponds to the cardinality of the first input. If “ij” is selected, the dimensions are in the same order as the cardinality of the inputs. |
In the future torch_meshgrid
will transition to indexing=’xy’ as the default.
This issue tracks this issue
with the goal of migrating to NumPy’s behavior.
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
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.