2021-12-07 12:17:56 +08:00
|
|
|
|
mindspore.nn.Flatten
|
|
|
|
|
|
====================
|
|
|
|
|
|
|
|
|
|
|
|
.. py:class:: mindspore.nn.Flatten
|
|
|
|
|
|
|
2021-12-20 15:33:20 +08:00
|
|
|
|
对输入Tensor的第0维之外的维度进行展平操作。
|
2021-12-07 12:17:56 +08:00
|
|
|
|
|
2022-07-22 16:25:38 +08:00
|
|
|
|
输入:
|
|
|
|
|
|
- **x** (Tensor) - 要展平的输入Tensor。数据类型为 `number <https://www.mindspore.cn/docs/zh-CN/master/api_python/mindspore/mindspore.dtype.html#mindspore.dtype>`_。shape为 :math:`(N, *)` ,其中 :math:`*` 表示任意的附加维度。
|
2021-12-07 12:17:56 +08:00
|
|
|
|
|
2022-07-22 16:25:38 +08:00
|
|
|
|
输出:
|
|
|
|
|
|
Tensor,shape为 :math:`(N, X)`,其中 :math:`X` 是输入 `x` 的shape除N之外的其余维度的乘积。
|
2021-12-07 12:17:56 +08:00
|
|
|
|
|
2022-07-22 16:25:38 +08:00
|
|
|
|
异常:
|
2022-07-26 11:11:41 +08:00
|
|
|
|
- **TypeError** - `x` 不是Tensor。
|