Inputs

Now, let's start by defining the model inputs as placeholders. The inputs of the model will be training data and the targets. We will also use a parameter called keep_probability for the dropout layer, which helps the model avoid overfitting:

def build_model_inputs(batch_size, num_steps):

# Declare placeholders for the input and output variables
inputs_x = tf.placeholder(tf.int32, [batch_size, num_steps], name='inputs')
targets_y = tf.placeholder(tf.int32, [batch_size, num_steps], name='targets')

# define the keep_probability for the dropout layer
keep_probability = tf.placeholder(tf.float32, name='keep_prob')

return inputs_x, targets_y, keep_probability
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset