0
0
TensorFlowml~10 mins

Why RNNs process sequential data in TensorFlow - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a simple RNN layer in TensorFlow.

TensorFlow
rnn_layer = tf.keras.layers.SimpleRNN([1], input_shape=(10, 8))
Drag options to blanks, or click blank then click option'
A32
Btf.keras.layers.SimpleRNN
CDense
Dactivation
Attempts:
3 left
💡 Hint
Common Mistakes
Using a layer type instead of a number for units.
Passing activation function as the first argument.
2fill in blank
medium

Complete the code to compile the RNN model with an optimizer.

TensorFlow
model.compile(optimizer='[1]', loss='mse')
Drag options to blanks, or click blank then click option'
Asoftmax
Badam
Crelu
Daccuracy
Attempts:
3 left
💡 Hint
Common Mistakes
Using activation functions instead of optimizer names.
Using metrics like 'accuracy' as optimizer.
3fill in blank
hard

Fix the error in the code to correctly reshape input data for the RNN.

TensorFlow
input_data = input_data.reshape(([1], 10, 8))
Drag options to blanks, or click blank then click option'
A10
B8
Cbatch_size
Dsequence_length
Attempts:
3 left
💡 Hint
Common Mistakes
Using sequence length or feature size as the first dimension.
Using fixed numbers instead of batch size variable.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps each word to its length if the length is greater than 3.

TensorFlow
{word: [1] for word in words if [2] > 3}
Drag options to blanks, or click blank then click option'
Alen(word)
Bword
Dword.length
Attempts:
3 left
💡 Hint
Common Mistakes
Using word.length which is not valid in Python.
Using the word itself instead of its length.
5fill in blank
hard

Fill all three blanks to create a dictionary that maps uppercase words to their lengths if length is greater than 4.

TensorFlow
{ [1]: [2] for word in words if [3] > 4 }
Drag options to blanks, or click blank then click option'
Aword.upper()
Blen(word)
Dword.lower()
Attempts:
3 left
💡 Hint
Common Mistakes
Using word.lower() instead of upper().
Using the word itself as the value instead of its length.