!29496 fix the error message of Select and optimize the documentation of L1Loss and SmoothL1Loss.

Merge pull request !29496 from wangshuide/wsd_master_new
This commit is contained in:
i-robot 2022-01-26 02:04:53 +00:00 committed by Gitee
commit 1e3f3b51d7
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
7 changed files with 17 additions and 9 deletions

View File

@ -26,6 +26,7 @@ mindspore.nn.Conv3dTranspose
- **padding** (Union(int, tuple[int])) - 输入的深度、高度和宽度方向上填充的数量。数据类型为int或包含6个整数的tuple。如果 `padding` 是一个整数,则前部、后部、顶部,底部,左边和右边的填充都等于 `padding` 。如果 `padding` 是6个整数的tuple则前部、尾部、顶部、底部、左边和右边的填充分别等于填充padding[0]、padding[1]、padding[2]、padding[3]、padding[4]和padding[5]。值应该要大于等于0默认值0。
- **dilation** (Union[int, tuple[int]]) - 三维卷积核膨胀尺寸。数据类型为int或三个整数的tuple。若 :math:`k > 1` 则kernel间隔 `k` 个元素进行采样。深度、高度和宽度方向上的 k ,其取值范围分别为[1, D]、[1, H]和[1, W]。默认值1。
- **group** (int) - 将过滤器拆分为组, `in_channels``out_channels` 必须可被 `group` 整除。当 `group` 大于1时暂不支持Ascend平台。默认值1。当前仅支持1。
- **output_padding** (Union(int, tuple[int])) - 输出的深度、高度和宽度方向上填充的数量。数据类型为int或包含6个整数的tuple。如果 `output_padding` 是一个整数,则前部、后部、顶部,底部,左边和右边的填充都等于 `output_padding` 。如果 `output_padding` 是6个整数的tuple则前部、尾部、顶部、底部、左边和右边的填充分别等于填充output_padding[0]、output_padding[1]、output_padding[2]、output_padding[3]、output_padding[4]output_padding[5]。值应该要大于等于0默认值0。
- **has_bias** (bool) - Conv3dTranspose层是否添加偏置参数。默认值False。
- **weight_init** (Union[Tensor, str, Initializer, numbers.Number]) - 权重参数的初始化方法。它可以是TensorstrInitializer或numbers.Number。当使用str时可选"TruncatedNormal""Normal""Uniform""HeUniform"和"XavierUniform"分布以及常量"One"和"Zero"分布的值,可接受别名"xavier_uniform""he_uniform""ones"和"zeros"。上述字符串大小写均可。更多细节请参考Initializer的值。默认值"normal"。
- **bias_init** (Union[Tensor, str, Initializer, numbers.Number]) - 偏置参数的初始化方法。可以使用的初始化方法与"weight_init"相同。更多细节请参考Initializer的值。默认值"zeros"。

View File

@ -35,3 +35,4 @@ mindspore.nn.L1Loss
**异常:**
**ValueError** - `reduction` 不为"mean"、"sum"或"none"。
**ValueError** - `logits``labels` 有不同的shape且不能互相广播。

View File

@ -37,6 +37,8 @@ mindspore.nn.SmoothL1Loss
**异常:**
- **TypeError** - `beta` 不是float。
- **TypeError** - `logits``labels` 不是Tensor。
- **TypeError** - `logits``labels` 的数据类型既不是float16也不是float32。
- **TypeError** - `logits` 的数据类型与 `labels` 不同。
- **ValueError** - `beta` 小于或等于0。
- **ValueError** - `logits` 的shape与 `labels` 不同。

View File

@ -170,10 +170,7 @@ std::vector<KernelAttr> NativeCpuKernelModFactory::GetSupportedKernelAttrList(co
std::vector<KernelAttr> result;
auto iter = name_to_attr_creator_.find(kernel_name);
if (iter == name_to_attr_creator_.end()) {
MS_LOG(EXCEPTION) << "For '" << kernel_name
<< ", only support these types: Concat, Pack, Stack, Split, Transpose, Unpack, AddN, "
"ConcatOffset or DynamicStitch currently, but got "
<< kernel_name;
MS_LOG(EXCEPTION) << "Not register CPU kernel of operator: " << kernel_name;
}
auto creators = iter->second;
result.reserve(creators.size());

View File

@ -62,7 +62,7 @@ abstract::BaseShapePtr SelectInferShape(const PrimitivePtr &primitive, const std
MS_LOG(ERROR) << " cond shape :" << input_args[kCondIndex]->BuildShape()->ToString();
MS_LOG(ERROR) << " x shape :" << input_args[kXIndex]->BuildShape()->ToString();
MS_LOG(ERROR) << " y shape :" << input_args[kYIndex]->BuildShape()->ToString();
MS_EXCEPTION(ValueError) << "The shape of cond, x and y should be equal";
MS_EXCEPTION(ValueError) << "The shape of cond, x and y should be the same.";
}
return input_args[1]->BuildShape();
}

View File

@ -740,7 +740,7 @@ class Conv3dTranspose(_Conv):
:math:`dilation * (kernel\_size - 1) - padding` amount of zero will be paded to the depth, height and width
directions of the input, they are inverses of each other in regard to the input and output shapes in this case.
However, when `stride` > 1, Conv2d maps multiple input shapes to the same output shape. Deconvolutional network
can refer to `Deconvolutional Networks <https://www.matthewzeiler.com/matzeiler/deconvolutionalnetworks.pdf>`_.
can refer to `Deconvolutional Networks <https://www.matthewzeiler.com/mattzeiler/deconvolutionalnetworks.pdf>`_.
Args:
in_channels (int): The channel number of the input tensor of the Conv3dTranspose layer.
@ -777,6 +777,13 @@ class Conv3dTranspose(_Conv):
[1, D], [1, H] and [1, W] respectively. Default: 1.
group (int): Splits filter into groups, `in_channels` and `out_channels` must be
divisible by `group`. Default: 1. Only 1 is currently supported.
output_padding (Union(int, tuple[int])): The number of padding on the depth, height and width directions of
the output. The data type is an integer or a tuple of six integers. If `output_padding` is an integer,
then the head, tail, top, bottom, left, and right padding are all equal to `output_padding`.
If `output_padding` is a tuple of six integers, then the head, tail, top, bottom, left, and right padding
is equal to `output_padding[0]`, `output_padding[1]`, `output_padding[2]`, `output_padding[3]`,
`output_padding[4]` and `output_padding[5]` respectively. The value should be greater than or equal to 0.
Default: 0.
has_bias (bool): Whether the Conv3dTranspose layer has a bias parameter. Default: False.
weight_init (Union[Tensor, str, Initializer, numbers.Number]): Initialization method of weight parameter.
It can be a Tensor, a string, an Initializer or a numbers.Number. When a string is specified,
@ -961,7 +968,7 @@ class Conv2dTranspose(_Conv):
:math:`dilation * (kernel\_size - 1) - padding` amount of zero will be paded to the height and width
directions of the input, they are inverses of each other in regard to the input and output shapes in this case.
However, when `stride` > 1, Conv2d maps multiple input shapes to the same output shape. Deconvolutional network
can refer to `Deconvolutional Networks <https://www.matthewzeiler.com/matzeiler/deconvolutionalnetworks.pdf>`_.
can refer to `Deconvolutional Networks <https://www.matthewzeiler.com/mattzeiler/deconvolutionalnetworks.pdf>`_.
Args:
in_channels (int): The channel number of the input tensor of the Conv2dTranspose layer.
@ -1171,7 +1178,7 @@ class Conv1dTranspose(_Conv):
:math:`dilation * (kernel\_size - 1) - padding` amount of zero will be paded to both sizes of input,
they are inverses of each other in regard to the input and output shapes in this case.
However, when `stride` > 1, Conv1d maps multiple input shapes to the same output shape. Deconvolutional network
can refer to `Deconvolutional Networks <https://www.matthewzeiler.com/matzeiler/deconvolutionalnetworks.pdf>`_.
can refer to `Deconvolutional Networks <https://www.matthewzeiler.com/mattzeiler/deconvolutionalnetworks.pdf>`_.
Args:
in_channels (int): The channel number of the input tensor of the Conv1dTranspose layer.

View File

@ -471,7 +471,7 @@ class SmoothL1Loss(LossBase):
TypeError: If `beta` is not a float.
TypeError: If `logits` or `labels` are not Tensor.
TypeError: If dtype of `logits` or `labels` is neither float16 not float32.
TypeError: If dtype of `logits` or `labels` are not the same.
TypeError: If dtype of `logits` is not the same as `labels`.
ValueError: If `beta` is less than or equal to 0.
ValueError: If shape of `logits` is not the same as `labels`.