| @@ -599,7 +599,7 @@ class Interpolate(Cell): | |||
| Inputs: | |||
| - **x** (Tensor) - Tensor to be resized. Input tensor must be a 4-D tensor with shape: | |||
| math:'(batch, channels, height, width)', with data type of float32 or float64. | |||
| math:'(batch, channels, height, width)', with data type of float32 or float64. | |||
| Outputs: | |||
| Resized tensor. | |||
| @@ -609,7 +609,7 @@ class Interpolate(Cell): | |||
| scale_factor * width)' in float32 | |||
| Supported Platforms: | |||
| ``Ascend`` | |||
| ``Ascend`` ``GPU`` ``CPU`` | |||
| Examples: | |||
| >>> from mindspore.ops import operations as P | |||
| @@ -703,7 +703,7 @@ class Tril(Cell): | |||
| Tensor, has the same type as input `x`. | |||
| Supported Platforms: | |||
| ``Ascend`` | |||
| ``Ascend`` ``GPU`` ``CPU`` | |||
| Examples: | |||
| >>> x = Tensor(np.array([[1, 2], [3, 4]])) | |||
| @@ -742,10 +742,13 @@ class Triu(Cell): | |||
| Outputs: | |||
| Tensor, has the same type as input `x`. | |||
| Supported Platforms: | |||
| ``Ascend`` ``GPU`` ``CPU`` | |||
| Examples: | |||
| >>> x = Tensor(np.array([[1, 2], [3, 4]])) | |||
| >>> tril = nn.Tril() | |||
| >>> result = tril(x) | |||
| >>> triu = nn.Triu() | |||
| >>> result = triu(x) | |||
| >>> print(result) | |||
| [[1 2] | |||
| [0 4]] | |||
| @@ -51,6 +51,36 @@ def get_bprop_fill(self): | |||
| return bprop | |||
| @bprop_getters.register(P.Ones) | |||
| def get_bprop_ones(self): | |||
| """Generate bprop for Ones""" | |||
| def bprop(dims, dtype, out, dout): | |||
| return zeros_like(dims) | |||
| return bprop | |||
| @bprop_getters.register(P.Zeros) | |||
| def get_bprop_zeros(self): | |||
| """Generate bprop for Zeros""" | |||
| def bprop(dims, dtype, out, dout): | |||
| return zeros_like(dims) | |||
| return bprop | |||
| @bprop_getters.register(P.SequenceMask) | |||
| def get_bprop_sequence_mask(self): | |||
| """Generate bprop for SequenceMask""" | |||
| def bprop(lengths, dtype, max_length, out, dout): | |||
| return zeros_like(dims), zeros_like(max_length) | |||
| return bprop | |||
| @bprop_getters.register(P.DType) | |||
| def get_bprop_dtype(self): | |||
| """Generate bprop for DType""" | |||
| @@ -1129,14 +1129,14 @@ class Ones(PrimitiveWithInfer): | |||
| Inputs: | |||
| - **shape** (Union[tuple[int], int]) - The specified shape of output tensor. | |||
| Only constant positive int is allowed. | |||
| Only constant positive int is allowed. | |||
| - **type** (mindspore.dtype) - The specified type of output tensor. Only constant value is allowed. | |||
| Outputs: | |||
| Tensor, has the same type and shape as input shape value. | |||
| Supported Platforms: | |||
| ``Ascend`` ``GPU`` | |||
| ``Ascend`` ``GPU`` ``CPU`` | |||
| Examples: | |||
| >>> from mindspore.ops import operations as ops | |||
| @@ -1182,14 +1182,14 @@ class Zeros(PrimitiveWithInfer): | |||
| Inputs: | |||
| - **shape** (Union[tuple[int], int]) - The specified shape of output tensor. | |||
| Only constant positive int is allowed. | |||
| Only constant positive int is allowed. | |||
| - **type** (mindspore.dtype) - The specified type of output tensor. Only constant value is allowed. | |||
| Outputs: | |||
| Tensor, has the same type and shape as input shape value. | |||
| Supported Platforms: | |||
| ``Ascend`` ``GPU`` | |||
| ``Ascend`` ``GPU`` ``CPU`` | |||
| Examples: | |||
| >>> from mindspore.ops import operations as ops | |||
| @@ -1239,7 +1239,7 @@ class SequenceMask(PrimitiveWithInfer): | |||
| Inputs: | |||
| - **lengths** (Union[tuple[int], list[int]]) - Defines the first N elements that are retained. | |||
| Only constant value is allowed. | |||
| Only constant value is allowed. | |||
| - **dtype** (mindspore.dtype) - The specified type of output tensor. Only constant value is allowed. | |||
| Outputs: | |||
| @@ -1248,6 +1248,9 @@ class SequenceMask(PrimitiveWithInfer): | |||
| If max_length is not set and the biggest value in lengths is x. Then, the shape of | |||
| the output is (lengths.shape, x). | |||
| Supported Platforms: | |||
| ``Ascend`` ``GPU`` ``CPU`` | |||
| Examples: | |||
| >>> from mindspore.ops import operations as P | |||
| >>> sequence_mask = P.SequenceMask() | |||