You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mindspore.nn.Unfold.rst 1.9 kB

1234567891011121314151617181920212223242526272829303132333435363738
  1. mindspore.nn.Unfold
  2. ====================
  3. .. py:class:: mindspore.nn.Unfold(ksizes, strides, rates, padding='valid')
  4. 从图像中提取滑窗的区域块。
  5. 输入为一个四维的Tensor,数据格式为(N, C, H, W)。
  6. **参数:**
  7. - **ksizes** (Union[tuple[int], list[int]]):滑窗大小,其格式为[1, ksize_row, ksize_col, 1]的int组成的tuple或list。
  8. - **strides** (Union[tuple[int], list[int]]):滑窗步长,其格式为[1, stride_row, stride_col, 1]的int组成的tuple或list。
  9. - **rates** (Union[tuple[int], list[int]]):滑窗元素之间的空洞个数,其格式为[1, rate_row, rate_col, 1] 的int组成的tuple或list。
  10. - **padding** (str):填充模式,可选值有:"same"或"valid"的字符串,不区分大小写。默认值:"valid"。
  11. - **same** - 指所提取的区域块的部分区域可以在原始图像之外,此部分填充为0。
  12. - **valid** - 表示所取的区域快必须被原始图像所覆盖。
  13. **输入:**
  14. - **x** (Tensor) - 输入四维Tensor, 其shape为[in_batch, in_depth, in_row, in_col],其数据类型为int。
  15. **输出:**
  16. Tensor,输出为四维Tensor,数据类型与 `x` 相同,其shape为(out_batch, out_depth, out_row, out_col),且 `out_batch` 与 `in_batch` 相同。
  17. :math:`out\_depth = ksize\_row * ksize\_col * in\_depth`
  18. :math:`out\_row = (in\_row - (ksize\_row + (ksize\_row - 1) * (rate\_row - 1))) // stride\_row + 1`
  19. :math:`out\_col = (in\_col - (ksize\_col + (ksize\_col - 1) * (rate\_col - 1))) // stride\_col + 1`
  20. **异常:**
  21. - **TypeError** - `ksize` , `strides` 或 `rates` 既不是tuple,也不是list。
  22. - **ValueError** - `ksize` , `strides` 或 `rates` 的shape不是(1, x_row, x_col, 1)。
  23. - **ValueError** - `ksize` , `strides` 或 `rates` 的第二个和第三个元素小于1。