解决 tensorflow.python.framework.errors_impl.InternalError: Could not find valid device for node.

运行tensorflow程序,报错如下:

tensorflow.python.framework.errors_impl.InternalError: Could not find valid device for node.
Node: {{node FusedBatchNorm}}
All kernels registered for op FusedBatchNorm :
device=‘XLA_CPU’; T in [DT_FLOAT]
device=‘XLA_CPU_JIT’; T in [DT_FLOAT]
device=‘CPU’; T in [DT_FLOAT]
[Op:FusedBatchNorm]

原因:convolutional输入数据类型为整数。

解决方法:
类型转化。x = tf.cast(x, tf.float32)

Reference:
https://stackoverflow.com/questions/51846682/eager-execution-internalerror-could-not-find-valid-device-for-node-name-sqr

你可能感兴趣的:(问题解决)