I want to make 2D into 3D

I am processing signals, but the signals are arranged in an array of 432 horizontal and 8750 vertical. I’m trying to classify this with cnn. Therefore, I would like to make this array into data such as image classification with 432 horizontal and 50 batch vertical 175. How do I convert an array?
The tensor type is now [128 (batch), 1 (vertical because we bring one data at a time), 423 (horizontal)], but I want to change this to [175,1 (input), 50,423].

Hello Yuhske, is this what you’re looking for:

x = torch.ones(432, 8750)
x_newshape = x.view(175, 1, 50, 432)
print(x_newshape.shape)

Output: 
torch.Size([175, 1, 50, 432])
1 Like

Thank you!!! I’m a beginner, so I’m grateful that I want to learn pytorch while asking questions.