python-3.xtensorflowkerasneural-network

How to solve : UnknownError: Graph execution error:


i have 2.14 version of keras and tensorflow. My cuda version is :

enter image description here

I am trying to fit a simple model but I get the following exception :

UnknownError: Graph execution error:

The code is :

Problem_with_Graph_execution_error.py

My computer is a ubuntu 20.04 with a python 3.10.14 (ipython 8.27.0).

Please, any ideas or experiences that could help me.


Solution

  • Try adding the following lines of code:

    import tensorflow as tf
    physical_devices = tf.config.list_physical_devices('GPU')
    tf.config.experimental.set_memory_growth(physical_devices[0], enable=True)