If multiple devices are found in the cluster, but there is a single device colocated with default_device, the single colocated device would be used by placer. This change relaxes the current check to account for parent device scope.
For example,
@tf.function()
def replica_fn()
with tf.device("gpu:0")
with tf.device("worker1"):
replica_fn()
In this case there may be multiple gpu:0 in the cluster, but gpu:0 on worker 1 should be picked. In this case, we should not receive multiple devices found error.
PiperOrigin-RevId: 357996270
Change-Id: I6a19deb5f26d7741ba7f7adff7f14550679b3d6d