powered by
For use with nn_sequential.
nn_flatten(start_dim = 2, end_dim = -1)
first dim to flatten (default = 2).
last dim to flatten (default = -1).
Input: (*, S_start,..., S_i, ..., S_end, *), where S_i is the size at dimension i and * means any number of dimensions including none.
(*, S_start,..., S_i, ..., S_end, *)
S_i
i
*
Output: (*, S_start*...*S_i*...S_end, *).
(*, S_start*...*S_i*...S_end, *)
nn_unflatten
if (torch_is_installed()) { input <- torch_randn(32, 1, 5, 5) m <- nn_flatten() m(input) }
Run the code above in your browser using DataLab