fchollet / deep-learning-with-python-notebooks

Jupyter notebooks for the code samples of the book "Deep Learning with Python"
MIT License
17.95k stars 8.48k forks source link

5-3 When trying to train categorization CNN in MNIST, I got UnimplementedError: Graph execution error #204

Open katieliao opened 2 years ago

katieliao commented 2 years ago

Hello

I used the code shown on the book and tried the code from the website as well (so I believe it is the correct code). Is there any version-related issues??

train_images = train_images.reshape((60000,28,28,1)) train_images = train_images.astype('float32')/255 test_images = test_images.reshape((10000,28,28,1)) test_images = test_images.astype('float32')/255 train_labels = to_categorical(train_labels) test_labels = to_categorical(test_labels) model.compile(optimizer = 'rmsprop', loss = 'categorical_crossentropy', metrics = ['accuracy']) model.fit(train_images, train_labels, epochs = 5, batch_size = 64)

I got error:

UnimplementedError Traceback (most recent call last) ~\AppData\Local\Temp/ipykernel_16856/1658854806.py in ----> 1 model.fit(train_images, train_labels, epochs = 5, batch_size = 64)

~\anaconda3\lib\site-packages\keras\utils\traceback_utils.py in error_handler(*args, **kwargs) 65 except Exception as e: # pylint: disable=broad-except 66 filtered_tb = _process_traceback_frames(e.traceback) ---> 67 raise e.with_traceback(filtered_tb) from None 68 finally: 69 del filtered_tb

~\anaconda3\lib\site-packages\tensorflow\python\eager\execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name) 52 try: 53 ctx.ensure_initialized() ---> 54 tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name, 55 inputs, attrs, num_outputs) 56 except core._NotOkStatusException as e:

UnimplementedError: Graph execution error:

Detected at node 'sequential_1/conv2d_3/Conv2D' defined at (most recent call last):