Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Tensorflow gpu在基本文本分类中不工作_Python_Tensorflow_Keras - Fatal编程技术网

Python Tensorflow gpu在基本文本分类中不工作

Python Tensorflow gpu在基本文本分类中不工作,python,tensorflow,keras,Python,Tensorflow,Keras,我有 tensorflow==2.3.0 tensorflow gpu==2.3.0 CUDA==10.1 cuDNN==7.6.5 我试着按照这个例子训练一个神经网络 为了启用GPU,我添加了以下代码 config = tf.compat.v1.ConfigProto() config.gpu_options.allow_growth = True session = tf.compat.v1.Session(config=config) 就在之前 model = keras.Seque

我有

  • tensorflow==2.3.0
  • tensorflow gpu==2.3.0
  • CUDA==10.1
  • cuDNN==7.6.5
我试着按照这个例子训练一个神经网络

为了启用GPU,我添加了以下代码

config = tf.compat.v1.ConfigProto()
config.gpu_options.allow_growth = True
session = tf.compat.v1.Session(config=config)
就在之前

model = keras.Sequential([
    keras.layers.Flatten(input_shape=(28, 28)),
    keras.layers.Dense(128, activation='relu'),
    keras.layers.Dense(10, activation='softmax')
])
在本例中,GPU正在工作!但在另一个例子中 当我在之前添加会话连接时

model = tf.keras.Sequential([
  layers.Embedding(max_features + 1, embedding_dim),
  layers.Dropout(0.2),
  layers.GlobalAveragePooling1D(),
  layers.Dropout(0.2),
  layers.Dense(1)])
GPU不工作


对于第二个示例,我需要做什么才能获得GPU?

什么是“GPU不工作”?你是怎么确定的?你怎么能说GPU不工作了?我的意思是视频卡不是用来训练神经网络的。