今天在做自己搭建一个LSTM做分类的时候,不停地出现以下问题:
tensorflow/stream_executor/cuda/cuda_blas.cc:443] failed to create cublas handle: CUBLAS_STATUS_NOT_INITIALIZED
加上以下代码:问题解决
physical_devices = tf.config.list_physical_devices('GPU')
tf.config.experimental.set_memory_growth(physical_devices[0], True)
意思是寻找可用的GPU
找到可用的GPU之后运行代码需要多少资源就GPU分配多少资源
没有以上代码
运行代码有多少资源就用多少资源,结果报错