【TensorFlow】InternalError: Failed copying input tensor

TensorFlow-GPU执行模型训练时报错:

InternalError: Failed copying input tensor from /job:localhost/replica:0/task:0/device:CPU:0 to /job:localhost/replica:0/task:0/device:GPU:0 in order to run _EagerConst: Dst tensor is not initialized.

解决方法:

【TensorFlow: Dst tensor is not initialized - Stack Overflow】

https://*.com/questions/37313818/tensorflow-dst-tensor-is-not-initialized

主要原因在于batch_size太大,内存无法负载,将batch_size适当调小即可正常运行。

  • 默认情况下,TF会尽可能地多分配占用GPU内存,通过调整GPUConfig可以设置为按需分配内存,参考此文档此代码
上一篇:idea打开错误出现Failed to create JVM问题解决


下一篇:Gradle sync failed: Sync failed: reason unknown