Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: Cannot feed value of shape (32, 10, 3) for Tensor u'input_1231:0', which has shape '(16, 10, 3)' #247

Open
chengfeifan opened this issue May 7, 2018 · 1 comment

Comments

@chengfeifan
Copy link

chengfeifan commented May 7, 2018

The shape of my train data normal_scale is (398,10,3),I try the following code, but it turns a shape error.


import seq2seq
from seq2seq.models import Seq2Seq

model = Seq2Seq(batch_input_shape=(16, 10, 3), hidden_dim=10, output_length=10, output_dim=3, depth=4)
model.compile(loss='mse', optimizer='rmsprop')
model.summary()
model.fit(x=normal_scale,y=normal_scale)

My model is

_________________________________________________________________________________________________
Layer (type)                    Output Shape         Param #     Connected to                     
==================================================================================================
input_1231 (InputLayer)         (16, 10, 3)          0                                            
__________________________________________________________________________________________________
time_distributed_19 (TimeDistri (16, 10, 10)         40          input_1231[0][0]                 
__________________________________________________________________________________________________
private__optional_input_place_h (2,)                 0                                            
__________________________________________________________________________________________________
private__optional_input_place_h (2,)                 0                                            
__________________________________________________________________________________________________
private__optional_input_place_h (2,)                 0                                            
__________________________________________________________________________________________________
recurrent_sequential_37 (Recurr [(16, 10), (16, 10), 3360        time_distributed_19[0][0]        
                                                                 private__optional_input_place_hol
                                                                 private__optional_input_place_hol
                                                                 private__optional_input_place_hol
__________________________________________________________________________________________________
dense_856 (Dense)               (16, 3)              33          recurrent_sequential_37[0][0]    
__________________________________________________________________________________________________
recurrent_sequential_38 (Recurr (16, 10, 3)          2372        dense_856[0][0]                  
                                                                 recurrent_sequential_37[0][1]    
                                                                 recurrent_sequential_37[0][2]    
                                                                 dense_856[0][0]                  
==================================================================================================
Total params: 5,805
Trainable params: 5,805
Non-trainable params: 0

Actually I don't have data shape of (32, 10, 3) , the error is

ValueError: Cannot feed value of shape (32, 10, 3) for Tensor u'input_1231:0', which has shape '(16, 10, 3)'

@chengfeifan
Copy link
Author

Actually I find the sample of data must be the whole-number multiple of the batch_size,and you need to set the batch_size at the model.fit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant