add squeeze functional api
This commit is contained in:
parent
5412cfe8e7
commit
0b9c39c13b
|
@ -373,6 +373,7 @@ Array操作
|
|||
mindspore.ops.space_to_batch_nd
|
||||
mindspore.ops.sparse_segment_mean
|
||||
mindspore.ops.split
|
||||
mindspore.ops.squeeze
|
||||
mindspore.ops.stack
|
||||
mindspore.ops.tensor_scatter_add
|
||||
mindspore.ops.tensor_scatter_div
|
||||
|
@ -408,8 +409,6 @@ Array操作
|
|||
- Refer to :class:`mindspore.ops.DType`.
|
||||
* - mindspore.ops.sort
|
||||
- Refer to :class:`mindspore.ops.Sort`.
|
||||
* - mindspore.ops.squeeze
|
||||
- Refer to :class:`mindspore.ops.Squeeze`.
|
||||
* - mindspore.ops.strided_slice
|
||||
- Refer to :class:`mindspore.ops.StridedSlice`.
|
||||
* - mindspore.ops.tensor_scatter_update
|
||||
|
|
|
@ -5,25 +5,4 @@ mindspore.ops.Squeeze
|
|||
|
||||
返回删除指定 `axis` 中大小为1的维度后的Tensor。
|
||||
|
||||
如果 :math:`axis=()` ,则删除所有大小为1的维度。
|
||||
如果指定了 `axis`,则删除指定 `axis` 中大小为1的维度。
|
||||
例如,如果不指定维度 :math:`axis=()` ,输入的shape为(A, 1, B, C, 1, D),则输出的Tensor的shape为(A, B, C, D);如果指定维度,squeeze操作仅在指定维度中进行。
|
||||
如果输入的shape为(A, 1, B), `axis` 设置为0时不会改变输入的Tensor,但 `axis` 设置为1时会使输入Tensor的shape变为(A, B)。
|
||||
|
||||
.. note::
|
||||
- 请注意,在动态图模式下,输出Tensor将与输入Tensor共享数据,并且没有Tensor数据复制过程。
|
||||
- 维度索引从0开始,并且必须在 `[-input_x.ndim, input_x.ndim)` 范围内。
|
||||
|
||||
参数:
|
||||
- **axis** (Union[int, tuple(int)]) - 指定待删除shape的维度索引,它会删除给定axis参数中所有大小为1的维度。如果指定了维度索引,其数据类型必须为int32或int64。默认值:(),空tuple。
|
||||
|
||||
输入:
|
||||
- **input_x** (Tensor) - 用于计算Squeeze的输入Tensor,shape为 :math:`(x_1, x_2, ..., x_R)` 。
|
||||
|
||||
输出:
|
||||
Tensor,shape为 :math:`(x_1, x_2, ..., x_S)` 。
|
||||
|
||||
异常:
|
||||
- **TypeError** - `axis` 既不是int也不是tuple。
|
||||
- **TypeError** - `axis` 是tuple,其元素并非全部是int。
|
||||
- **ValueError** - 指定 `axis` 的对应维度不等于1。
|
||||
更多参考详见 :func:`mindspore.ops.squeeze`。
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
mindspore.ops.squeeze
|
||||
=====================
|
||||
|
||||
.. py:function:: mindspore.ops.squeeze(input_x, axis=())
|
||||
|
||||
返回删除指定 `axis` 中大小为1的维度后的Tensor。
|
||||
|
||||
如果 :math:`axis=()` ,则删除所有大小为1的维度。
|
||||
如果指定了 `axis`,则删除指定 `axis` 中大小为1的维度。
|
||||
例如,如果不指定维度 :math:`axis=()` ,输入的shape为(A, 1, B, C, 1, D),则输出的Tensor的shape为(A, B, C, D);如果指定维度,squeeze操作仅在指定维度中进行。
|
||||
如果输入的shape为(A, 1, B), `axis` 设置为0时不会改变输入的Tensor,但 `axis` 设置为1时会使输入Tensor的shape变为(A, B)。
|
||||
|
||||
.. note::
|
||||
- 请注意,在动态图模式下,输出Tensor将与输入Tensor共享数据,并且没有Tensor数据复制过程。
|
||||
- 维度索引从0开始,并且必须在 `[-input_x.ndim, input_x.ndim)` 范围内。
|
||||
|
||||
参数:
|
||||
- **input_x** (Tensor) - 用于计算Squeeze的输入Tensor,shape为 :math:`(x_1, x_2, ..., x_R)` 。
|
||||
- **axis** (Union[int, tuple(int)]) - 指定待删除shape的维度索引,它会删除给定axis参数中所有大小为1的维度。如果指定了维度索引,其数据类型必须为int32或int64。默认值:(),空tuple。
|
||||
|
||||
返回:
|
||||
Tensor,shape为 :math:`(x_1, x_2, ..., x_S)` 。
|
||||
|
||||
异常:
|
||||
- **TypeError** - `axis` 既不是int也不是tuple。
|
||||
- **TypeError** - `axis` 是tuple,其元素并非全部是int。
|
||||
- **ValueError** - 指定 `axis` 的对应维度不等于1。
|
|
@ -373,6 +373,7 @@ Array Operation
|
|||
mindspore.ops.space_to_batch_nd
|
||||
mindspore.ops.sparse_segment_mean
|
||||
mindspore.ops.split
|
||||
mindspore.ops.squeeze
|
||||
mindspore.ops.stack
|
||||
mindspore.ops.tensor_scatter_add
|
||||
mindspore.ops.tensor_scatter_min
|
||||
|
@ -408,8 +409,6 @@ Array Operation
|
|||
- Refer to :class:`mindspore.ops.DType`.
|
||||
* - mindspore.ops.sort
|
||||
- Refer to :class:`mindspore.ops.Sort`.
|
||||
* - mindspore.ops.squeeze
|
||||
- Refer to :class:`mindspore.ops.Squeeze`.
|
||||
* - mindspore.ops.strided_slice
|
||||
- Refer to :class:`mindspore.ops.StridedSlice`.
|
||||
* - mindspore.ops.tensor_scatter_update
|
||||
|
|
Loading…
Reference in New Issue