r"""Broadcasts a tensor to given shape. Args: inp: input tensor. shape: target shape. Returns: output tensor. Examples: >>> import numpy as np >>> data = Tensor(np.arange(0, 3, dtype=np.float32).reshape(3)) >>> out = F.broadcast_to(data,
(inp: Tensor, shape: Union[int, Iterable[int]])
| 541 | |
| 542 | |
| 543 | def broadcast_to(inp: Tensor, shape: Union[int, Iterable[int]]) -> Tensor: |
| 544 | r"""Broadcasts a tensor to given shape. |
| 545 | |
| 546 | Args: |
| 547 | inp: input tensor. |
| 548 | shape: target shape. |
| 549 | |
| 550 | Returns: |
| 551 | output tensor. |
| 552 | |
| 553 | Examples: |
| 554 | >>> import numpy as np |
| 555 | >>> data = Tensor(np.arange(0, 3, dtype=np.float32).reshape(3)) |
| 556 | >>> out = F.broadcast_to(data, (2, 3)) |
| 557 | >>> out.numpy() |
| 558 | array([[0., 1., 2.], |
| 559 | [0., 1., 2.]], dtype=float32) |
| 560 | """ |
| 561 | return broadcast_cpp(inp, shape) |
| 562 | |
| 563 | |
| 564 | def concat(inps: Iterable[Tensor], axis: int = 0, device=None) -> Tensor: |
no outgoing calls
no test coverage detected