-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Concatenates the given sequence of `tensors` in the given dimension `dim`. Differ from `torch.cat`, values along the concatenating dimension are grouped according to the indicies defined in the `index` tensors. All tensors must either have the same shape (except in the concatenating dimension) or be empty and all index tensors must in the same sequence as in `tensors`. Examples: ``` >>> x1 = torch.tensor([[0.2716, 0.4233, 0.2658, 0.8284], ... [0.3166, 0.0142, 0.1700, 0.2944], ... [0.2371, 0.3839, 0.7193, 0.2954], ... [0.4100, 0.0012, 0.5114, 0.3353]]) >>> x2 = torch.tensor([[0.3752, 0.5782, 0.7105, 0.4002], ... [0.7757, 0.5999, 0.7898, 0.0753]]) >>> x1_index = torch.LongTensor([0,0,1,2]) >>> x2_index = torch.LongTensor([0,2]) >>> scatter_concat([x1,x2], [x1_index,x2_index], 0) tensor([[0.2716, 0.4233, 0.2658, 0.8284], [0.3166, 0.0142, 0.1700, 0.2944], [0.3752, 0.5782, 0.7105, 0.4002], [0.2371, 0.3839, 0.7193, 0.2954], [0.4100, 0.0012, 0.5114, 0.3353], [0.7757, 0.5999, 0.7898, 0.0753]]) ``` --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: rusty1s <[email protected]>
- Loading branch information
1 parent
e0d6b66
commit f8ebf6a
Showing
4 changed files
with
68 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters