“Could not find valid device for node.” while eagerly executing.
This cryptic error happens when the input to a function has the wrong type!
Here is an example:
This will return a long error that basically says:
If you pay close attention, it is saying the the input to the function sqrt should be one of
Here is an example:
import tensorflow as tftf.enable_eager_execution()tf.sqrt(4)This will return a long error that basically says:
InternalError: Could not find valid device for node.Node: {{node Sqrt}} = Sqrt[T=DT_INT32](dummy_input)All kernels registered for op Sqrt :device='XLA_CPU'; T in [DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_HALF]device='XLA_GPU'; T in [DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_BFLOAT16, DT_HALF]device='XLA_CPU_JIT'; T in [DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_HALF]device='XLA_GPU_JIT'; T in [DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_BFLOAT16, DT_HALF]device='GPU'; T in [DT_DOUBLE]device='GPU'; T in [DT_HALF]device='GPU'; T in [DT_FLOAT]device='CPU'; T in [DT_COMPLEX128]device='CPU'; T in [DT_COMPLEX64]device='CPU'; T in [DT_BFLOAT16]device='CPU'; T in [DT_DOUBLE]device='CPU'; T in [DT_HALF]device='CPU'; T in [DT_FLOAT][Op:Sqrt] name: Sqrt/If you pay close attention, it is saying the the input to the function sqrt should be one of
double, half, float, complex,... but our input is dt_int32 that’s the problem. This works:import tensorflow as tftf.enable_eager_execution()tf.sqrt(4.) #notice that now the input is a float number
Comments