Fix crash if set_visible_devices() used with tf.keras.mixed_precision, part 2.

I thought I fixed this in 10e5748ddf, but didn't, since I still called list_local_devices().

Fixes https://github.com/tensorflow/tensorflow/issues/38516.

PiperOrigin-RevId: 306711358
Change-Id: Ic07ff827c42bae925bd20fc360d51bbc94f457c5
This commit is contained in:
Reed Wanderman-Milne 2020-04-15 13:38:36 -07:00 committed by TensorFlower Gardener
parent d4de6e7c21
commit 2730e4b0bc

View File

@ -154,8 +154,8 @@ def log_device_compatibility_check(policy_name, skip_local):
if not context.executing_eagerly() or _logged_compatibility_check:
return
_logged_compatibility_check = True
device_attr_list = device_lib.list_local_devices()
if not skip_local:
device_attr_list = device_lib.list_local_devices()
_log_device_compatibility_check(policy_name, device_attr_list)
return