Problem about splitting a Variable

Hello there,

I am trying to make a full-connected network for a classifier with two output classes that I feed with a tensor containing two sequences of data.

I would like to have each sequence go through two linear layers and then join the output back to go through two linear layers before getting to the output, but I am currently at a loss at how to split the input.
My input tensor is shaped like this : [1 x 2 x 23320] and I would like to split it into two [1 x 232320] but somehow what I am doing is very wrong and seems to be doing nothing.

temp = x.split(1) 
x1 = temp[0]
x2 = temp[1]

tells me that the tuple index is out of range for x2.

I know I am doing something the wrong way, but I cannot figure what exactly, if someone has some pointers, that would be nice.
Thanks.

Hi,

I think by default, it splits on the 0th dimension, try doing x.split(1, dim=1) ?

1 Like

This did indeed solve my problem, thanks a lot!