Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

torch_flatten

Flatten


Description

Flatten

Usage

torch_flatten(self, dims, start_dim = 1L, end_dim = -1L, out_dim)

Arguments

self

(Tensor) the input tensor.

dims

if tensor is named you can pass the name of the dimensions to flatten

start_dim

(int) the first dim to flatten

end_dim

(int) the last dim to flatten

out_dim

the name of the resulting dimension if a named tensor.

flatten(input, start_dim=0, end_dim=-1) -> Tensor

Flattens a contiguous range of dims in a tensor.

Examples

if (torch_is_installed()) {

t = torch_tensor(matrix(c(1, 2), ncol = 2))
torch_flatten(t)
torch_flatten(t, start_dim=2)
}

torch

Tensors and Neural Networks with 'GPU' Acceleration

v0.3.0
MIT + file LICENSE
Authors
Daniel Falbel [aut, cre, cph], Javier Luraschi [aut], Dmitriy Selivanov [ctb], Athos Damiani [ctb], Christophe Regouby [ctb], Krzysztof Joachimiak [ctb], RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.