Amithkuppili commited on
Commit
38ff60b
·
verified ·
1 Parent(s): 3ba01ce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -26,7 +26,10 @@ tgt_index_to_word[0] = "" # padding
26
  # Note: this matches the training architecture above.
27
  encoder_inputs = model.input[0]
28
  encoder_emb_output = model.layers[2](encoder_inputs)
29
- encoder_lstm_output, state_h_enc, state_c_enc = model.layers[3](encoder_emb_output)
 
 
 
30
  encoder_model = tf.keras.Model(encoder_inputs, [state_h_enc, state_c_enc])
31
 
32
 
@@ -39,9 +42,12 @@ decoder_dense = model.layers[6]
39
  dec_state_input_h = tf.keras.Input(shape=(decoder_lstm.units,))
40
  dec_state_input_c = tf.keras.Input(shape=(decoder_lstm.units,))
41
  dec_emb2 = dec_emb_layer(decoder_inputs)
42
- dec_outputs, state_h_dec, state_c_dec = decoder_lstm(
43
  dec_emb2, initial_state=[dec_state_input_h, dec_state_input_c]
44
  )
 
 
 
45
  dec_outputs = decoder_dense(dec_outputs)
46
  decoder_model = tf.keras.Model(
47
  [decoder_inputs, dec_state_input_h, dec_state_input_c],
 
26
  # Note: this matches the training architecture above.
27
  encoder_inputs = model.input[0]
28
  encoder_emb_output = model.layers[2](encoder_inputs)
29
+ encoder_lstm = model.layers[3]
30
+ encoder_outputs = encoder_lstm(encoder_emb_output)
31
+ state_h_enc = encoder_outputs[1]
32
+ state_c_enc = encoder_outputs[2]
33
  encoder_model = tf.keras.Model(encoder_inputs, [state_h_enc, state_c_enc])
34
 
35
 
 
42
  dec_state_input_h = tf.keras.Input(shape=(decoder_lstm.units,))
43
  dec_state_input_c = tf.keras.Input(shape=(decoder_lstm.units,))
44
  dec_emb2 = dec_emb_layer(decoder_inputs)
45
+ decoder_lstm_outputs = decoder_lstm(
46
  dec_emb2, initial_state=[dec_state_input_h, dec_state_input_c]
47
  )
48
+ dec_outputs = decoder_lstm_outputs[0]
49
+ state_h_dec = decoder_lstm_outputs[1]
50
+ state_c_dec = decoder_lstm_outputs[2]
51
  dec_outputs = decoder_dense(dec_outputs)
52
  decoder_model = tf.keras.Model(
53
  [decoder_inputs, dec_state_input_h, dec_state_input_c],