When I run code in C1_W3 Lab1, the code running normal neural networks (without convolution layers) is passed, but I got a bug when running code that adding convolution layers. The error message is included in below.
I just run code written in the lab, do not change anything, but cannot figure out what causes it. Can you upgrade this lab to a new version?
_________________________________________________________________
Epoch 1/5
---------------------------------------------------------------------------
UnknownError Traceback (most recent call last)
<ipython-input-14-3c9b5b992e4d> in <module>()
18 model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])
19 model.summary()
---> 20 model.fit(training_images, training_labels, epochs=5)
21 test_loss = model.evaluate(test_images, test_labels)
6 frames
/usr/local/lib/python3.7/dist-packages/tensorflow/python/eager/execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name)
58 ctx.ensure_initialized()
59 tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
---> 60 inputs, attrs, num_outputs)
61 except core._NotOkStatusException as e:
62 if name is not None:
UnknownError: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
[[node sequential_6/conv2d_8/Conv2D (defined at <ipython-input-14-3c9b5b992e4d>:20) ]] [Op:__inference_train_function_42579]
Function call stack:
train_function
The relevant code if you don't know where it is.
import tensorflow as tf
print(tf.__version__)
mnist = tf.keras.datasets.fashion_mnist
(training_images, training_labels), (test_images, test_labels) = mnist.load_data()
training_images=training_images.reshape(60000, 28, 28, 1)
training_images=training_images / 255.0
test_images = test_images.reshape(10000, 28, 28, 1)
test_images=test_images/255.0
model = tf.keras.models.Sequential([
tf.keras.layers.Conv2D(64, (3,3), activation='relu', input_shape=(28, 28, 1)),
tf.keras.layers.MaxPooling2D(2, 2),
tf.keras.layers.Conv2D(64, (3,3), activation='relu'),
tf.keras.layers.MaxPooling2D(2,2),
tf.keras.layers.Flatten(),
tf.keras.layers.Dense(128, activation='relu'),
tf.keras.layers.Dense(10, activation='softmax')
])
model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])
model.summary()
model.fit(training_images, training_labels, epochs=5) # the bug is here
test_loss = model.evaluate(test_images, test_labels)