r"""Returns a tensor filled with ones with the same shape and data type as input tensor. Args: inp(Tensor): input tensor from which to derive the output tensor shape. Return: a tensor having the same shape as input tensor and filled with ones. Examples: >>> x =
(inp: Tensor)
| 408 | |
| 409 | |
| 410 | def ones_like(inp: Tensor) -> Tensor: |
| 411 | r"""Returns a tensor filled with ones with the same shape and data type as input tensor. |
| 412 | |
| 413 | Args: |
| 414 | inp(Tensor): input tensor from which to derive the output tensor shape. |
| 415 | |
| 416 | Return: |
| 417 | a tensor having the same shape as input tensor and filled with ones. |
| 418 | |
| 419 | Examples: |
| 420 | >>> x = F.arange(6, dtype='int32').reshape(2, 3) |
| 421 | >>> F.ones_like(x) |
| 422 | Tensor([[1 1 1] |
| 423 | [1 1 1]], dtype=int32, device=xpux:0) |
| 424 | """ |
| 425 | return full_like(inp, 1.0) |
| 426 | |
| 427 | |
| 428 | def polar(abs: Tensor, angle: Tensor) -> Tensor: |