!49523 ResizeLinea1D文档修改

Merge pull request !49523 from haozhang/code_docs_resize_linear1d
This commit is contained in:
i-robot 2023-03-03 03:00:07 +00:00 committed by Gitee
commit 9dff86b515
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 10 additions and 8 deletions

View File

@ -10,8 +10,9 @@ mindspore.ops.ResizeLinear1D
使用通用resize功能请参考 :func:`mindspore.ops.interpolate` 使用通用resize功能请参考 :func:`mindspore.ops.interpolate`
.. warning:: .. warning::
实验特性,接口可能发生变化。 - 实验特性,接口可能发生变化。
目前,昇腾平台仅支持输入 `size` 为Tuple或List的场景。 - 目前,昇腾平台仅支持输入 `size` 为Tuple或List的场景。
- 同时昇腾平台上未支持属性coordinate_transformation_mode为asymmetric的情景。
参数: 参数:
- **coordinate_transformation_mode** (str) - 指定进行坐标变换的方式,默认值是"align_corners",还可选"half_pixel"和"asymmetric"。 - **coordinate_transformation_mode** (str) - 指定进行坐标变换的方式,默认值是"align_corners",还可选"half_pixel"和"asymmetric"。

View File

@ -1475,7 +1475,7 @@ class DynamicBroadcastTo(Primitive):
ValueError: if the target and input shapes are incompatible. ValueError: if the target and input shapes are incompatible.
Supported Platforms: Supported Platforms:
``Ascend`` ``Ascend`` ``GPU`` ``CPU``
""" """
@prim_attr_register @prim_attr_register

View File

@ -649,8 +649,9 @@ class ResizeLinear1D(Primitive):
For general resize, refer to :func:`mindspore.ops.interpolate` for more details. For general resize, refer to :func:`mindspore.ops.interpolate` for more details.
.. warning:: .. warning::
This is an experimental feature and is subjected to change. - This is an experimental feature and is subjected to change.
Currently, the Ascend platform only supports scenarios where the input `size` is Tuple or List. - Currently, the Ascend platform only supports scenarios where the input `size` is Tuple or List.
- And the attr `coordinate_transformation_mode` should not be 'asymmetric' in Ascend platform.
Args: Args:
coordinate_transformation_mode (str): Default is 'align_corners'. Describes how to transform the coordinate coordinate_transformation_mode (str): Default is 'align_corners'. Describes how to transform the coordinate
@ -672,13 +673,13 @@ class ResizeLinear1D(Primitive):
TypeError: If `coordinate_transformation_mode` is not in the support list. TypeError: If `coordinate_transformation_mode` is not in the support list.
Supported Platforms: Supported Platforms:
``GPU`` ``CPU`` ``Ascend`` ``Ascend`` ``GPU`` ``CPU``
Examples: Examples:
>>> input = Tensor([[[1, 2, 3], [4, 5, 6]]], mindspore.float32) >>> x = Tensor([[[1, 2, 3], [4, 5, 6]]], mindspore.float32)
>>> size = Tensor([6], mindspore.int32) >>> size = Tensor([6], mindspore.int32)
>>> resize_linear_1d = ops.ResizeLinear1D(coordinate_transformation_mode="align_corners") >>> resize_linear_1d = ops.ResizeLinear1D(coordinate_transformation_mode="align_corners")
>>> output = resize_linear_1d(x=input, size=size) >>> output = resize_linear_1d(x, size)
>>> print(output) >>> print(output)
[[[1. 1.4 1.8 2.2 2.6 3.] [[[1. 1.4 1.8 2.2 2.6 3.]
[4. 4.4 4.8 5.2 5.6 6.]]] [4. 4.4 4.8 5.2 5.6 6.]]]