|
|
@@ -1129,14 +1129,14 @@ class Ones(PrimitiveWithInfer): |
|
|
|
|
|
|
|
|
Inputs: |
|
|
Inputs: |
|
|
- **shape** (Union[tuple[int], int]) - The specified shape of output tensor. |
|
|
- **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. |
|
|
- **type** (mindspore.dtype) - The specified type of output tensor. Only constant value is allowed. |
|
|
|
|
|
|
|
|
Outputs: |
|
|
Outputs: |
|
|
Tensor, has the same type and shape as input shape value. |
|
|
Tensor, has the same type and shape as input shape value. |
|
|
|
|
|
|
|
|
Supported Platforms: |
|
|
Supported Platforms: |
|
|
``Ascend`` ``GPU`` |
|
|
|
|
|
|
|
|
``Ascend`` ``GPU`` ``CPU`` |
|
|
|
|
|
|
|
|
Examples: |
|
|
Examples: |
|
|
>>> from mindspore.ops import operations as ops |
|
|
>>> from mindspore.ops import operations as ops |
|
|
@@ -1182,14 +1182,14 @@ class Zeros(PrimitiveWithInfer): |
|
|
|
|
|
|
|
|
Inputs: |
|
|
Inputs: |
|
|
- **shape** (Union[tuple[int], int]) - The specified shape of output tensor. |
|
|
- **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. |
|
|
- **type** (mindspore.dtype) - The specified type of output tensor. Only constant value is allowed. |
|
|
|
|
|
|
|
|
Outputs: |
|
|
Outputs: |
|
|
Tensor, has the same type and shape as input shape value. |
|
|
Tensor, has the same type and shape as input shape value. |
|
|
|
|
|
|
|
|
Supported Platforms: |
|
|
Supported Platforms: |
|
|
``Ascend`` ``GPU`` |
|
|
|
|
|
|
|
|
``Ascend`` ``GPU`` ``CPU`` |
|
|
|
|
|
|
|
|
Examples: |
|
|
Examples: |
|
|
>>> from mindspore.ops import operations as ops |
|
|
>>> from mindspore.ops import operations as ops |
|
|
@@ -1239,7 +1239,7 @@ class SequenceMask(PrimitiveWithInfer): |
|
|
|
|
|
|
|
|
Inputs: |
|
|
Inputs: |
|
|
- **lengths** (Union[tuple[int], list[int]]) - Defines the first N elements that are retained. |
|
|
- **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. |
|
|
- **dtype** (mindspore.dtype) - The specified type of output tensor. Only constant value is allowed. |
|
|
|
|
|
|
|
|
Outputs: |
|
|
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 |
|
|
If max_length is not set and the biggest value in lengths is x. Then, the shape of |
|
|
the output is (lengths.shape, x). |
|
|
the output is (lengths.shape, x). |
|
|
|
|
|
|
|
|
|
|
|
Supported Platforms: |
|
|
|
|
|
``Ascend`` ``GPU`` ``CPU`` |
|
|
|
|
|
|
|
|
Examples: |
|
|
Examples: |
|
|
>>> from mindspore.ops import operations as P |
|
|
>>> from mindspore.ops import operations as P |
|
|
>>> sequence_mask = P.SequenceMask() |
|
|
>>> sequence_mask = P.SequenceMask() |
|
|
|