1

I obtain the following error when running tensorflow (before the model training).

tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot assign a device for operation cond_1/then/_10/cond_1/Adam/add: Could not satisfy explicit device specification '/job:localhost/replica:0/task:0/device:GPU:0' because no supported kernel for GPU devices is available.
Colocation Debug Info:
Colocation group had the following types and supported devices: 
Root Member(assigned_device_name_index_=-1 requested_device_name_='/job:localhost/replica:0/task:0/device:GPU:0' assigned_device_name_='' resource_device_name_='' supported_device_types_=[CPU] possible_devices_=[]
AddV2: CPU 

Colocation members, user-requested devices, and framework assigned devices, if any:
  cond_1/then/_10/cond_1/Adam/add (AddV2) /job:localhost/replica:0/task:0/device:GPU:0

Op: AddV2
Node attrs: T=DT_INT64
Registered kernels:
  device='XLA_CPU_JIT'; T in [DT_FLOAT, DT_DOUBLE, DT_INT32, DT_UINT8, DT_INT16, DT_INT8, DT_COMPLEX64, DT_INT64, DT_BFLOAT16, DT_UINT16, DT_COMPLEX128, DT_HALF, DT_UINT32, DT_UINT64]
  device='GPU'; T in [DT_FLOAT]
  device='DEFAULT'; T in [DT_INT32]
  device='CPU'; T in [DT_FLOAT]
  device='CPU'; T in [DT_HALF]
  device='CPU'; T in [DT_DOUBLE]
  device='CPU'; T in [DT_INT32]
  device='CPU'; T in [DT_INT64]
  device='CPU'; T in [DT_BFLOAT16]
  device='CPU'; T in [DT_INT8]
  device='CPU'; T in [DT_INT16]
  device='CPU'; T in [DT_COMPLEX64]
  device='CPU'; T in [DT_UINT8]
  device='CPU'; T in [DT_UINT16]
  device='CPU'; T in [DT_UINT32]
  device='CPU'; T in [DT_UINT64]
  device='CPU'; T in [DT_COMPLEX128]

         [[{{node cond_1/Adam/add}}]] [Op:__inference_train_112314]

My questions are: What is the meaning of this error and how can it be fixed? I'm working on Apples M1 with MacOs Monterey. Tensorflow 2.5.0. I do not quite understand the origin of the error since running tf.config.list_physical_devices() showes me:

[PhysicalDevice(name='/physical_device:CPU:0', device_type='CPU'), PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]

Those three questions are related but also remained without a solution: first, second, third

Enabling sess = tf.Session(config=tf.ConfigProto(allow_soft_placement=True, log_device_placement=True)) mentioned here did not resolve the problem for me.

Mariusmarten
  • 255
  • 3
  • 15

0 Answers0