Python 从目录中使用tf.keras.preprocessing.image\u数据集时出现异常

Python 从目录中使用tf.keras.preprocessing.image\u数据集时出现异常,python,tensorflow,keras,typespec,Python,Tensorflow,Keras,Typespec,我通过pip安装了tf nightly gpu和tf nightly,以便从_目录使用tf.keras.preprocessing.image_dataset_。 我的数据集位于“data/train”中,在这里我为每个类[“愤怒”、“厌恶”、“恐惧”…]都有一个目录。 当我打电话时 tf.keras.preprocessing.image\u dataset\u来自目录(“数据/列车”) 我得到一个有趣的例外: > Traceback (most recent call last):

我通过pip安装了tf nightly gpu和tf nightly,以便从_目录使用tf.keras.preprocessing.image_dataset_。
我的数据集位于“data/train”中,在这里我为每个类[“愤怒”、“厌恶”、“恐惧”…]都有一个目录。
当我打电话时

tf.keras.preprocessing.image\u dataset\u来自目录(“数据/列车”)

我得到一个有趣的例外:

> Traceback (most recent call last):  
  File "installs/anaconda/lib/python3.7/site-packages/tensorflow/python/data/util/structure.py", line 106, in normalize_element  
    spec = type_spec_from_value(t, use_fallback=False)  
  File "installs/anaconda/lib/python3.7/site-packages/tensorflow/python/data/util/structure.py",   line 480, in type_spec_from_value  
    (element, type(element).__name__))  
TypeError: Could not build a TypeSpec for ['data/train/disgusted/im381.png', 'data/train/sad/im4432.png',...]
然后,它列出了我的整个数据集。除此之外:

tensorflow.python.framework.errors_impl.InternalError: cudaGetDevice() failed. Status: initialization error