PyTorch: concat and flatten inputs of different shape
I have multiple inputs of different shape: (7,), (), (6,), how can I concatenate and flatten them to a single flatten input. My desired output shape is (14,).
For example: arr1= [1, 2, 3], arr2=6, arr3=[6,7], output=[1,2,3,6,6,7]. Although I can use multiple numpy.append, but that would be ugly.

You can use torch.cat:
import torch

arr1 = torch.tensor([1, 2, 3])
arr2 = torch.tensor([6])
arr3 = torch.tensor([6,7])

torch.cat((arr1,arr2,arr3))
&gt;&gt;&gt; tensor([1, 2, 3, 6, 6, 7])

