# tensorplay.functional.unflatten Source: https://www.tensorplay.cn/docs/generated/tensorplay.functional.unflatten.html ```python tensorplay.functional.unflatten(input, dim, sizes) → Tensor ``` Expands a dimension of the input tensor over multiple dimensions. > **See also** > > tensorplay.flatten() the inverse of this function. It coalesces several dimensions into one. Parameters: - input ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor)) – the input tensor. - dim ([int](https://docs.python.org/3/builtins/functions.html#int)) – Dimension to be unflattened, specified as an index into input.shape. - sizes (Tuple[[int](https://docs.python.org/3/builtins/functions.html#int)]) – New shape of the unflattened dimension. One of its elements can be -1 in which case the corresponding output dimension is inferred. Otherwise, the product of sizes must equal input.shape[dim]. Returns: A View of input with the specified dimension unflattened. Examples:: ``` >>> tensorplay.unflatten(tensorplay.randn(3, 4, 1), 1, (2, 2)).shape tensorplay.Size([3, 2, 2, 1]) >>> tensorplay.unflatten(tensorplay.randn(3, 4, 1), 1, (-1, 2)).shape tensorplay.Size([3, 2, 2, 1]) >>> tensorplay.unflatten(tensorplay.randn(5, 12, 3), -2, (2, 2, 3, 1, 1)).shape tensorplay.Size([5, 2, 2, 3, 1, 1, 3]) ```