The first problem is that X and y are numpy arrays, not torch variables.
X = Variable(X)
y = Variable(y)

The next problem is that X must be of shape (timesteps, batches, features). In your case batches is 1, and features is 1.
The forward method of your model does correctly select only the last timestep of the RNN prediction. So your model output will be of shape (batches, features).
The third problem is that the model uses a softmax after the dense layer. The dense layer outputs a vector of one feature, and softmax ensures that this vector sums to one. Your model can only output a vector containing the single value [1].
Softmax is only used for “classification” problems, but your data is processed as a “regression” problem, in other words your model receives several values of diff_data and  must try to predict the next value of diff_data.
A “classification” problem would be to predict “will the price go up or down during the next day” which is a simple binary choice. In that case, softmax would be appropriate.
You could also have multiple classes, e.g. “price will go up a lot”, “price will go up a little”, “price will go down a little”, “price will go down a lot”, where the threshold between “a lot” and “a little” is set in advance. Softmax would be appropriate here too.

  
      stats.stackexchange.com
  
  
      
    
  

  What is the relationship between classification and regression in Neural Network? 7



  regression, neural-networks



  asked by
  
  
    Alexander Yau
  
  on 09:00AM - 01 Dec 16