2017-05-29 7 views
1

https://github.com/baidu-research/ba-dls-deepspeech/のテンソルフローバックエンドを使用しようとしています。 model.pyにあるcompile_gru_model関数は、バックエンドの変更時にTypeErrorを返します。 GRU層の実行のケアのバックエンドをtheanoからtensorflowに変更する際のTypeError

# Main acoustic input 
acoustic_input = Input(shape=(None, input_dim), name='acoustic_input') 

# Setup the network 
conv_1d = Convolution1D(nodes, conv_context, name='conv1d', 
         border_mode=conv_border_mode, 
         subsample_length=conv_stride, init=initialization, 
         activation='relu')(acoustic_input) 
if batch_norm: 
    output = BatchNormalization(name='bn_conv_1d', mode=2)(conv_1d) 
else: 
    output = conv_1d 

for r in range(recur_layers): 
    output = GRU(nodes, activation='relu', 
       name='rnn_{}'.format(r + 1), init=initialization, 
       return_sequences=True)(output) 
    if batch_norm: 
     bn_layer = BatchNormalization(name='bn_rnn_{}'.format(r + 1), 
             mode=2) 
     output = bn_layer(output) 

、それがエラーを与える:

TypeError: Expected int32, got <tf.Variable 'rnn_1_W_z_1:0' shape=(1024, 1024) dtype=float32_ref> of type 'Variable' instead. 

でもK.castを(使用INT32する入力をキャストに)、エラーが解消されません。このコードはtheanoバックエンドで動作しました。

Tensorflowバージョン:1.1.0
Kerasバージョン:1.1.2

任意の助けをいただければ幸いです。ありがとう!

+0

関連https://stackoverflow.com/questions/41813665/tensorflow-slim-typeerror-expected-int32-got-list-containing-tensors-of-type、TensorflowのAPI変更によって発生します。ケアのテンソルフローまたはアップグレードのダウングレードが必要 –

答えて

1

記録のために、keras 2.0.4にアップグレードすることで問題が解決しました。

関連する問題