提交 c6ba87d9 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!5804 fix bugs of op Fill, Equal, Eye, Conv2dTranspose and ExpandDims

Merge pull request !5804 from lihongkang/lhk_master
......@@ -139,7 +139,7 @@ class Validator:
def check_int_range(arg_name, arg_value, lower_limit, upper_limit, rel, prim_name):
"""Method for checking whether an int value is in some range."""
rel_fn = Rel.get_fns(rel)
type_mismatch = not isinstance(arg_value, int)
type_mismatch = not isinstance(arg_value, int) or isinstance(arg_value, bool)
excp_cls = TypeError if type_mismatch else ValueError
if type_mismatch or not rel_fn(arg_value, lower_limit, upper_limit):
rel_str = Rel.get_strs(rel).format(lower_limit, upper_limit)
......
......@@ -461,7 +461,8 @@ class Conv2dTranspose(_Conv):
width of the kernel.
stride (Union[int, tuple[int]]): The distance of kernel moving, an int number that represents
the height and width of movement are both strides, or a tuple of two int numbers that
represent height and width of movement respectively. Default: 1.
represent height and width of movement respectively. Its value should be equal to or greater than 1.
Default: 1.
pad_mode (str): Select the mode of the pad. The optional values are
"pad", "same", "valid". Default: "same".
......
......@@ -115,6 +115,8 @@ class ExpandDims(PrimitiveWithInfer):
>>> input_tensor = Tensor(np.array([[2, 2], [2, 2]]), mindspore.float32)
>>> expand_dims = P.ExpandDims()
>>> output = expand_dims(input_tensor, 0)
[[[2.0, 2.0],
[2.0, 2.0]]]
"""
@prim_attr_register
......@@ -887,6 +889,8 @@ class Fill(PrimitiveWithInfer):
Examples:
>>> fill = P.Fill()
>>> fill(mindspore.float32, (2, 2), 1)
[[1.0, 1.0],
[1.0, 1.0]]
"""
@prim_attr_register
......@@ -2364,6 +2368,8 @@ class Eye(PrimitiveWithInfer):
Examples:
>>> eye = P.Eye()
>>> out_tensor = eye(2, 2, mindspore.int32)
[[1, 0],
[0, 1]]
"""
@prim_attr_register
......
......@@ -2244,10 +2244,10 @@ class Equal(_LogicBinaryOp):
When the inputs are one tensor and one scalar, the scalar only could be a constant.
Inputs:
- **input_x** (Union[Tensor, Number, bool]) - The first input is a number or
a bool or a tensor whose data type is number or bool.
- **input_y** (Union[Tensor, Number, bool]) - The second input is a number or
a bool when the first input is a tensor or a tensor whose data type is number or bool.
- **input_x** (Union[Tensor, Number]) - The first input is a number or
a tensor whose data type is number.
- **input_y** (Union[Tensor, Number]) - The second input is a number
when the first input is a tensor or a tensor whose data type is number.
Outputs:
Tensor, the shape is the same as the one after broadcasting,and the data type is bool.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册