r"""Returns a tensor filled with given value with the same shape as input tensor. Args: inp(Tensor): input tensor from which to derive the output tensor shape. value(Scalar): fill value. Return: a tensor having the same shape as input tensor and where every element
(inp: Tensor, value: Union[int, float])
| 515 | |
| 516 | |
| 517 | def full_like(inp: Tensor, value: Union[int, float]) -> Tensor: |
| 518 | r"""Returns a tensor filled with given value with the same shape as input tensor. |
| 519 | |
| 520 | Args: |
| 521 | inp(Tensor): input tensor from which to derive the output tensor shape. |
| 522 | value(Scalar): fill value. |
| 523 | |
| 524 | Return: |
| 525 | a tensor having the same shape as input tensor and where every element is equal to fill value. |
| 526 | |
| 527 | Examples: |
| 528 | >>> x = F.arange(6, dtype='int32').reshape(2, 3) |
| 529 | >>> F.full_like(x, 2) |
| 530 | Tensor([[2 2 2] |
| 531 | [2 2 2]], dtype=int32, device=xpux:0) |
| 532 | """ |
| 533 | op = builtin.FillLike(value=value) |
| 534 | (rst,) = apply(op, inp) |
| 535 | # rst.format = inp.format |
| 536 | # see jira:MGE-4505 |
| 537 | return rst |
| 538 | |
| 539 | |
| 540 | # manipulation functions |
no test coverage detected