几个tensorflow的错误,发现没有办法在GPU上跑
包括tf.gather
, tf.image.resize_nearest_neighbor
等,报如下错误:
ResizeNearestNeighbor: Could not satisfy explicit device specification '/device:GPU:0' because no supported kernel for GPU devices is available.
之前只能在前面加上with tf.device("/cpu:0"):
今天查了一下,是tf没有在CUDA运算中为这几种操作添加对应Data type
的Registered kernels
,解决方法可以手动添加。
目前我是通过hack的手段解决的,先把输入的tensor
做tf.cast
到支持的数据类型(比如 float32,或int64, 视具体情况而定),然后输入相应函数,输出后再cast回原数据类型
END