torch.nn.Unflatten
new Unflatten(dim: number, unflattened_size: readonly number[])
Constructor Parameters
dimnumber- Dimension to unflatten
unflattened_sizereadonly number[]- New shape for the unflattened dimension
Unflattens a tensor dimension, expanding it to a desired shape.
Examples
const unflatten = new torch.nn.Unflatten(1, [2, 5, 5]);
const input = torch.randn(2, 50);
const output = unflatten.forward(input); // shape: [2, 2, 5, 5]