Complete the code to define the input layer for an autoencoder.
input_img = tf.keras.Input(shape=[1])The input shape for flattened 28x28 grayscale MNIST images is (784,), typical for simple Dense autoencoders.
Complete the code to add an encoding Dense layer with 64 units and ReLU activation.
encoded = tf.keras.layers.Dense([1], activation='relu')(input_img)
The encoding layer typically reduces dimensionality; here 64 units with ReLU activation is common.
Fix the error in the decoder layer to reconstruct the original input shape.
decoded = tf.keras.layers.Dense([1], activation='sigmoid')(encoded)
The decoder output layer should have the same number of units as the flattened input size (28*28=784) to reconstruct the image.
Fill both blanks to compile the autoencoder model with optimizer and loss function.
autoencoder.compile(optimizer=[1], loss=[2])
Adam optimizer and binary crossentropy loss are commonly used for autoencoders with normalized pixel values.
Fill all three blanks to create a dictionary comprehension that maps words to their lengths if length is greater than 3.
lengths = { [1] : [2] for [3] in words if len([3]) > 3 }The dictionary comprehension uses 'word' as key, 'len(word)' as value, and iterates over 'word' in words.
