!49307 fix full like example code

Merge pull request !49307 from 于振华/code_docs_fix_fulllike_230223
This commit is contained in:
i-robot 2023-02-23 07:22:10 +00:00 committed by Gitee
commit 5d2f0b7d26
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 4 additions and 2 deletions

View File

@ -760,11 +760,13 @@ def full_like(x, fill_value, *, dtype=None):
``Ascend`` ``GPU`` ``CPU``
Examples:
>>> output = ops.full_like((2, 2), 1)
>>> input = Tensor([[0, 1], [2, 1]], dtype=mindspore.int32)
>>> output = ops.full_like(input, 1)
>>> print(output)
[[1. 1.]
[1. 1.]]
>>> output = ops.full_like((3, 3), 0)
>>> input = Tensor([[0, 1, 1], [2, 1, 2], [1, 3, 4]], dtype=mindspore.int32)
>>> output = ops.full_like(input, 0)
>>> print(output)
[[0. 0. 0.]
[0. 0. 0.]