mindspore/docs/api/api_python/dataset_vision/mindspore.dataset.vision.Sl...

23 lines
1.5 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.dataset.vision.SlicePatches
=====================================
.. py:class:: mindspore.dataset.vision.SlicePatches(num_height=1, num_width=1, slice_mode=SliceMode.PAD, fill_value=0)
在水平和垂直方向上将Tensor切片为多个块。适合于Tensor高宽较大的使用场景。如果将 `num_height``num_width` 都设置为 1则Tensor将保持不变。输出Tensor的数量等于 num_height*num_width。
参数:
- **num_height** (int, 可选) - 垂直方向的切块数量。默认值1。
- **num_width** (int, 可选) - 水平方向的切块数量。默认值1。
- **slice_mode** (Inter, 可选) - 表示填充或丢弃,它可以是 [SliceMode.PAD, SliceMode.DROP] 中的任何一个。默认值SliceMode.PAD。
- **fill_value** (int, 可选) - 如果 `slice_mode` 取值为 SliceMode.PAD该值表示在右侧和底部的边界填充宽度以像素数计`fill_value` 取值必须在[0255]范围内。默认值0。
异常:
- **TypeError** - 当 `num_height` 不是int。
- **TypeError** - 当 `num_width` 不是int。
- **TypeError** - 当 `slice_mode` 的类型不为 :class:`mindspore.dataset.vision.Inter`
- **TypeError** - 当 `fill_value` 不是int。
- **ValueError** - 当 `num_height` 不为正数。
- **ValueError** - 当 `num_width` 不为正数。
- **ValueError** - 当 `fill_value` 不在 [0, 255]范围内。
- **RuntimeError** - 如果输入的Tensor不是 <H, W> 或<H, W, C> 格式。