2016-07-04 9 views
0

tensorflow에서 LSTM을 사용하여 다중 레이어 RNN을 만들려고합니다. Ubuntu 14.04에서 Tensorflow 버전 0.9.0과 Python 2.7을 사용하고 있습니다.Tensorflow RNN 슬라이스 오류

size = 1000 
config.forget_bias = 1 
and config.num_layers = 3 
cell = rnn_cell.LSTMCell(size,forget_bias=config.forget_bias) 
cell_layers = rnn_cell.MultiRNNCell([cell]*config.num_layers) 
: num_layers가 1보다 큰

내 코드의 경우 내가

rnn_cell.MultiRNNCell([cell]*num_layers) 

를 사용할 때

tensorflow.python.framework.errors.InvalidArgumentError: Expected begin[1] in [0, 2000], but got 4000 

:

그러나, 나는 다음과 같은 오류가 계속

나는 또한 li 애는 GRU 세포를 사용하도록 전환 할 수 있지만, 이것은 나에게 같은 오류가 있습니다 : 나는 명시 적으로도 도움이되지 않았다

num_proj = 1000 

설정을 시도

Expected begin[1] in [0, 1000], but got 2000 

합니다.

이것은 연결된 국가를 사용하는 것과 관련이 있습니까? 내가 설정하는 시도로

state_is_tuple=True 

주는 :

`ValueError: Some cells return tuples of states, but the flag state_is_tuple is not set. State sizes are: [LSTMStateTuple(c=1000, h=1000), LSTMStateTuple(c=1000, h=1000), LSTMStateTuple(c=1000, h=1000)]` 

어떤 도움이 많이 주시면 감사하겠습니다!

답변

0

왜이 기능이 작동하는지 잘 모르겠지만 dropout wrapper에 추가했습니다. 즉

if Training: 
    cell = rnn_cell.DropoutWrapper(cell,output_keep_prob=config.keep_prob) 

이제는 작동합니다. LSTM 및 GRU 셀 모두에서 작동합니다.

0

GRU 셀의 레이어를 증가 시켰지만 초기 벡터가 두 배로되지 않기 때문에이 문제가 발생합니다. initial_vector 크기가 [batch_size, 50] 인 경우

이어서 initial_vector tf.concat = (1, [initial_vector * num_layers)

지금 입력이 초기 값으로하는 디코더.

관련 문제