Reputation: 904
I have a tensor, t
, of the following shape: torch.Size([280, 4, 768])
.
What I want is to achieve, effectively, concatenation along the second axis, resulting in torch.Size([280, 3072])
.
I know that I can for instance, do:
torch.cat((x[:, -4, :], x[:, -3, :], x[:, -2, :], x[:, -1, :]), dim=1)
but is there a nicer way of writing this?
How do I achieve reshaping along the second axis without messing up my values?
Upvotes: 1
Views: 1682