首页 > 解决方案 > ImportError:无法导入名称“迭代器”

问题描述

我想在 Google Colab 上运行分段代码(在 github 中有此链接:https ://github.com/taigw/brats17 ),我遇到了这个错误:

/usr/local/lib/python3.6/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
Traceback (most recent call last):
  File "test.py", line 18, in <module>
    from tensorflow.contrib.data import Iterator
ImportError: cannot import name 'Iterator'

标签: pythontensorflowiterator

解决方案


尝试这个:

import tensorflow as tf
Iterator = tf.data.Iterator

推荐阅读