educative.io

Educative

Is the answer correct?

def run_bilstm(self, input_sequences, is_training):
input_embeddings, sequence_lengths = self.get_input_embeddings(input_sequences)
dropout_keep_prob = 0.5 if is_training else 1.0
cell = self.make_lstm_cell(dropout_keep_prob)
rnn = tf.keras.layers.RNN(cell, return_sequences=True ,
go_backwards=True , return_state=True)

    Bi_rnn= tf.keras.layers.Bidirectional(
          rnn,
          merge_mode=None
          )
    input_embeddings = tf.compat.v1.placeholder(
            tf.float32, shape=(None, 10, 12))
    outputs = Bi_rnn(input_embeddings)
    return outputs

why do we need this line?
input_embeddings = tf.compat.v1.placeholder(
tf.float32, shape=(None, 10, 12))

It is defining the fixed style dimension of embedding that will always be fed to Bi_rnn. To use those values, we will call feed_dict, as a placeholder tensor can’t be fed directly. It is a tensor used as a handle for feeding a value but not evaluated directly.