I guess the last batch could be smaller than the other ones, thus x_i might be e.g. [1, 24] instead of the expected [2, 24].
Could you add a print statement right before the .split call and check the shapes during training, and which shape x_i has before throwing this error?
A workaround could be to drop the last smaller batch via drop_last=True in your DataLoader.