Fix `TypeError: 'dict_keys'` in contrib.distribute with python 3 (#18212)
authorYong Tang <yong.tang.github@outlook.com>
Thu, 5 Apr 2018 23:49:29 +0000 (16:49 -0700)
committerAndrew Harp <andrewharp@users.noreply.github.com>
Thu, 5 Apr 2018 23:49:29 +0000 (19:49 -0400)
commitd5fc41a8ca69d37696c7c324e19a3a724b70192b
treefdb62101291c23df8461f0898fbc41d490235c04
parentffe24e657bc9dc365f98de17e7118d94d88c3705
Fix `TypeError: 'dict_keys'` in contrib.distribute with python 3 (#18212)

This fix tries to fix the issue raised in 18205 where
```
TypeError: 'dict_keys' object does not support indexing
```
was thrown when using contrib.distribute in python 3.

The issue is that DistributedValues.devices returned `self._index.keys()`
which is a `dict_keys` and is not a list in python 3.

This fix converts the `dict_keys` to list for python 3
to fix the issue.

This fix fixes 18205.
This fix als fixes 18188.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
tensorflow/contrib/distribute/python/values.py