mindspore/docs/api/api_python/ops/mindspore.ops.ScaleAndTrans...

38 lines
2.2 KiB
ReStructuredText
Raw Normal View History

2022-11-12 19:48:47 +08:00
mindspore.ops.ScaleAndTranslate
================================
2022-11-21 15:48:37 +08:00
.. py:class:: mindspore.ops.ScaleAndTranslate(kernel_type='lanczos3', antialias=True)
2022-11-12 19:48:47 +08:00
根缩放并平移输入图像Tensor。
.. note::
- 输入图像必须是4D Tensor。
- 输入 `size``scale``translation` 必须是包含两个元素的一维Tensor。
参数:
2022-11-21 15:48:37 +08:00
- **kernel_type** (str可选) - 决定选择哪种图像滤波算法。可选列表:["lanczos1", "lanczos3", "lanczos5", "gaussian", "box", "triangle", "keyscubic", "mitchellcubic"]。默认值“lanczos3”。
2022-11-12 19:48:47 +08:00
- **antialias** (bool可选) - 决定是否使用抗锯齿。默认值True。
输入:
- **images** (Tensor) - 四维Tensorshape为 :math:`(batch, image\_height, image\_width, channel)`
2022-11-12 19:48:47 +08:00
- **size** (Tensor) - 缩放和平移操作后输出图像的大小。包含两个正数的的一维Tensor形状必须为 :math:`(2,)` 数据类型为int32。
- **scale** (Tensor) - 指示缩放因子。包含两个正数的的一维Tensor形状必须为 :math:`(2,)` 数据类型为int32。
- **translation** (Tensor) - 平移像素值。包含两个数的的一维Tensor形状必须为 :math:`(2,)` 数据类型为float32。
输出:
4-D Tensor其shape为 :math:`(batch, size[0], size[1], channel)` 数据类型为float32。
异常:
- **TypeError** - `kernel_type` 不是str类型。
- **TypeError** - `antialias` bool类型。
- **TypeError** - `images` 数据类型无效。
- **TypeError** - `size` 不是int32类型。
2022-11-22 17:33:37 +08:00
- **TypeError** - `scale` 不是float32类型。
2022-11-12 19:48:47 +08:00
- **TypeError** - `translation` 不是Tensor或者数据类型不是float32。
2022-11-28 12:00:46 +08:00
- **ValueError** - `kernel_type` 不在列表里面:["lanczos1", "lanczos3", "lanczos5", "gaussian", "box", "triangle", "keyscubic", "mitchellcubic"]。
2022-11-12 19:48:47 +08:00
- **ValueError** - `images` 的秩不等于4。
- **ValueError** - `size` 的shape不是 :math:`(2,)`
2022-11-22 17:33:37 +08:00
- **ValueError** - `scale` 的shape不是 :math:`(2,)`
- **ValueError** - `translation` 的shape不是 :math:`(2,)`
2022-11-12 19:48:47 +08:00