mindspore/docs/api/api_python/ops/mindspore.ops.BatchToSpace.rst

32 lines
1.6 KiB
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.ops.BatchToSpace
===========================
.. py:class:: mindspore.ops.BatchToSpace(block_size, crops)
将批处理数据重新排列到空间数据中。
此操作将批处理维度N拆分为 `block_size` 大小的块blocks输出Tensor的维度N即为拆分后对应的块数。输出Tensor的H、W维分别是原H、W维和 `block_size` 在给定裁剪量情况下的乘积。
参数:
- **block_size** (int) - 指定拆分的块大小其值不能小于2。
- **crops** (Union[list(int), tuple(int)]) - 指定H和W维度上的裁剪值包含2个列表。每个列表包含2个整数。所有值都必须不小于0。crops[i]表示指定空间维度i的裁剪值该维度对应于输入维度i+2。要求 :math:`input\_shape[i+2]*block\_size > crops[i][0]+crops[i][1]`
输入:
- **input_x** (Tensor) - 输入Tensor。必须是四维第0维度维度n的大小必须可被 `block_size` 的乘积整除。数据类型为float16或float32。
输出:
Tensor数据类型与输入Tensor相同。假设输入shape为 :math:`(n,c,h,w)` ,经过 `block_size``crops` 计算后。输出shape将为 :math:`(n'c'h'w')` ,其中
:math:`n' = n//(block\_size*block\_size)`
:math:`c' = c`
:math:`h' = h*block\_size-crops[0][0]-crops[0][1]`
:math:`w' = w*block\_size-crops[1][0]-crops[1][1]`
异常:
- **TypeError** - 如果 `block_size``crops` 的元素不是int。
- **TypeError** - 如果 `ccrops` 既不是list也不是tuple。
- **ValueError** - 如果 `block_size` 的值小于2。