【Hackathon 5th No.14】Add combinations API to Paddle by Patrick-Star125 · Pull Request #57792 · PaddlePaddle/Paddle
| >>> import paddle | |
| >>> x = paddle.to_tensor([1, 2, 3], dtype='int32') | |
| >>> res = paddle.combinations(x) | |
| >>> print(res) | |
| Tensor(shape=[3, 2], dtype=int32, place=Place(gpu:0), stop_gradient=True, | |
| [[1, 2], | |
| [1, 3], | |
| [2, 3]]) | |
| >>> import paddle | |
| >>> x = paddle.to_tensor([1, 2, 3], dtype='int32') | |
| >>> res = paddle.combinations(x) | |
| >>> print(res) | |
| Tensor(shape=[3, 2], dtype=int32, place=Place(gpu:0), stop_gradient=True, | |
| [[1, 2], | |
| [1, 3], | |
| [2, 3]]) |