Flatten¶
- class paddle.nn. Flatten ( start_axis=1, stop_axis=- 1 ) [source]
-
This interface is used to construct a callable object of the
FLatten
class. For more details, refer to code examples. It implements flatten a contiguous range of dims into a tensor.- Parameters
-
start_axis (int) – first dim to flatten (default = 1)
stop_axis (int) – last dim to flatten (default = -1).
- Returns
-
None
Examples
>>> import paddle >>> inp = paddle.ones([5, 2, 3, 4]).astype('float32') >>> flatten = paddle.nn.Flatten(start_axis=1, stop_axis=2) >>> y = flatten(inp) >>> print(y.shape) [5, 6, 4]
-
forward
(
input
)
forward¶
-
Defines the computation performed at every call. Should be overridden by all subclasses.
- Parameters
-
*inputs (tuple) – unpacked tuple arguments
**kwargs (dict) – unpacked dict arguments