2017-05-29 3 views
1

Ich versuche, Tensorflow Backend für https://github.com/baidu-research/ba-dls-deepspeech/ zu verwenden. Die Funktion compile_gru_model in model.py gibt einen TypeError beim Ändern des Backends.TypeError beim Ändern Keras Backend von Theano zu Tensorflow

# 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) 

auf die GRU-Schicht ausgeführt wird, gibt es Fehler:

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

Auch auf den Eingang Gießen mit K.cast() int32, bleibt der Fehler. Dieser Code hat am Backend von theano funktioniert.

Tensorflow Version: 1.1.0
Keras Version: 1.1.2

Jede Hilfe würde geschätzt. Vielen Dank!

+0

Verwandte https://stackoverflow.com/questions/41813665/tensorflow-slim-typeerror-expected-int32-got-list-containing-sensors-of-type, verursacht durch API-Änderung in Tensorflow. Benötigt downgrade von Tensorflow oder Upgrade von Keras –

Antwort

1

Zur Erinnerung, das Problem wurde durch ein Upgrade auf Keras 2.0.4 gelöst.

Verwandte Themen