提交 0d22e64f 编写于 作者: J jiangjinsheng

fix LinSpace doc

上级 7304f024
...@@ -132,23 +132,19 @@ class Range(Cell): ...@@ -132,23 +132,19 @@ class Range(Cell):
class LinSpace(Cell): class LinSpace(Cell):
r""" r"""
Generates values in an interval. And return the corresponding interpolation accroding to assist. Generates values in an interval.
Args: Args:
- **start** (Union[int, float]) - The start of interval, With shape of 0-D. start (Union[int, float]): The start of interval. With shape of 0-D.
- **stop** (Union[int, float]) - The end of interval, With shape of 0-D. stop (Union[int, float]): The end of interval. With shape of 0-D.
- **num** (int) - ticks number in the interval, the ticks include start and stop value. num (int): ticks number in the interval, the ticks include start and stop value. With shape of 0-D.
With shape of 0-D.
Outputs: Outputs:
Tensor, With type same as `start`. The shape is 1-D with length of `num`. Tensor, With type same as `start`. The shape is 1-D with length of `num`.
Examples: Examples:
>>> linspace = nn.LinSpace() >>> linspace = nn.LinSpace(1, 10, 5)
>>> start = Tensor(1, mindspore.float32) >>> output = linspace()
>>> stop = Tensor(10, mindspore.float32)
>>> num = Tensor(5, mindspore.int32)
>>> output = linspace(start, stop, num)
[1, 3.25, 5.5, 7.75, 10] [1, 3.25, 5.5, 7.75, 10]
""" """
......
...@@ -2711,7 +2711,7 @@ class ROIAlign(PrimitiveWithInfer): ...@@ -2711,7 +2711,7 @@ class ROIAlign(PrimitiveWithInfer):
Examples: Examples:
>>> input_tensor = Tensor(np.array([[[[1., 2.], [3., 4.]]]]), mindspore.float32) >>> input_tensor = Tensor(np.array([[[[1., 2.], [3., 4.]]]]), mindspore.float32)
>>> rois = Tensor(np.array([[0, 0.2, 0.3, 0.2, 0.3]]), mindspore.float32) >>> rois = Tensor(np.array([[0, 0.2, 0.3, 0.2, 0.3]]), mindspore.float32)
>>> roi_align = P.ROIAlign(1, 1, 0.5, 2) >>> roi_align = P.ROIAlign(2, 2, 0.5, 2)
>>> output_tensor = roi_align(input_tensor, rois) >>> output_tensor = roi_align(input_tensor, rois)
>>> assert output_tensor == Tensor(np.array([[[[2.15]]]]), mindspore.float32) >>> assert output_tensor == Tensor(np.array([[[[2.15]]]]), mindspore.float32)
""" """
...@@ -4980,4 +4980,5 @@ class LRN(PrimitiveWithInfer): ...@@ -4980,4 +4980,5 @@ class LRN(PrimitiveWithInfer):
return x_dtype return x_dtype
def infer_shape(self, x_shape): def infer_shape(self, x_shape):
validator.check_integer("x_shape", len(x_shape), 4, Rel.EQ, self.name)
return x_shape return x_shape
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册