본문 바로가기
연구 노트/R Python

ValueError: Input 0 of layer "sequential" is incompatible with the layer: expected shape=(None, 100, 1), found shape=(None, 21)

by 피에치 2022. 1. 20.
반응형

LSTM 다룰 때 중요한 부분!

에러 

 

ValueError: Input 0 of layer "sequential" is incompatible with the layer: expected shape=(None, 100, 1), found shape=(None, 21)

 

 

 

원인

LSTM 모델을 사용할 때는, train 차원을 바꾸어야 하는데, 차원 변경을 해 주지 않으면 발생하는 에러

 

 

 

해결

 

X_train = X_train.reshape(X_train.shape[0], X_train[1], 1) 

명령으로 2차원 데이터를 3차원으로 변경하면 됨. 

728x90
반응형