I have training samples of the following shape: (1000,2). These are numeric sequences, each of length = 1000, dimensions = 2.

I need to build a Convolutional Neural Network to output Predictions/Sequences of the same shape (1000, 2). From what I understand, after applying convolution and pooling, the height and width of the input is reduced.

How should I then set up the fully connected layer(s) and an output layer in my CNN, so that the output dimensions match the input dimensions? Or in general, how should I set up my CNN architecture to achieve this?

  • $\begingroup$ From your comments below, it sounds like you are trying to predict the next value of a series $X_1, X_2, \dots,$ where each $X_i$ is $(1000,2)$-dimensional. $\endgroup$ Commented Feb 25, 2018 at 19:05

2 Answers 2


You have (at least) two options. You can either:

  • Use a bottleneck architecture where you use pooling layers to reduce the dimensions of your data and then upcast it again using deconvolutional/upsampling layers to go back to the original dimensions. The advantage of this approach is that you use a bigger receptive field for the final output, which means it can look at a bigger part of your input sequence. You could combine this with a highway connection like structure. A very similar concept is used in 2d with segmentation, here the spatial dimensions are preserved at the output. One of the best models is called a U-Net.

  • Use no pooling and only padding-same convolutional layers with non-linearities. You can increase the depth but you will keep the (1000, 2) dimensions everywhere. The advantage is that it is very easy to implement, and if applicable to your problem only uses relatively local information.

  • $\begingroup$ Thank you very much for your answer. I actually have a more general question, I was wondering if you have any suggestions. I have samples of sequences which I mentioned in my question, I need to build a CNN (not RNN) for sequence prediction. I'm not given any target sequences. So, in this case, if I were to use RNN, I would use all but the last time step in each sequence as a training sequence, and all but the first time step as a target sequence. But in case of CNN, should the training and target sequences be the same, is this correct? $\endgroup$ Commented Nov 28, 2017 at 2:50
  • $\begingroup$ Also, the 2nd approach you suggested (use no pooling and same padding) should work, but I was wondering if there is any other CNN architecture that is appropriate for this type of sequence prediction? In my case, I'd need the predicted sequence to be of the same dimensions as input sequences, since I'm using MSE loss for evaluation. $\endgroup$ Commented Nov 28, 2017 at 2:57
  • $\begingroup$ You are not given any target sequences? You mean you need to predict the next step? I think in general RNNs are more appropriate for this but it certainly can be done with CNN. You would do something similar, as training sequence remove the last time step, and as prediction sequence remove the first step. You have to be careful though, you can only use convolutional filters that go backward basically. If you include 'future' steps you leak your target hard. $\endgroup$ Commented Nov 28, 2017 at 10:45

From your comments, it sounds like you are trying to predict the next value of a series $X_1, X_2, \dots,$ where each $X_i$ is $(1000,2)$-dimensional.

How about this: To predict $X_i$, you feed in the tensor $(X_{i-k}, X_{i-(k+1)}, \dots, X_{i-1})$, which has dimensions $(1000, 2, k)$. You apply convolution with stride $1$ and appropriate padding to the first and the second dimension: this does not change dimensions. And you apply pooling to the third dimension only (for example, set $k=8$ and use three pooling layers with window size $2\times 2$).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.