Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/311.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python &引用;SystemError:错误返回,无异常设置“;使用_生成器中的tf.data.Dataset_Python_Tensorflow_Pycharm_Tensorflow Datasets - Fatal编程技术网

Python &引用;SystemError:错误返回,无异常设置“;使用_生成器中的tf.data.Dataset

Python &引用;SystemError:错误返回,无异常设置“;使用_生成器中的tf.data.Dataset,python,tensorflow,pycharm,tensorflow-datasets,Python,Tensorflow,Pycharm,Tensorflow Datasets,在使用tf.data.Dataset.from_generator时,我遇到了一个奇怪的运行时错误 import tensorflow as tf def gen(): while True: yield 0, 0 batch = ( tf.data.Dataset.from_generator( gen, output_types=(tf.int32, tf.int32)) .batch(8) .repeat() .make_one_shot_itera

在使用
tf.data.Dataset.from_generator
时,我遇到了一个奇怪的运行时错误

import tensorflow as tf

def gen():
  while True:
    yield 0, 0

batch = (
  tf.data.Dataset.from_generator(
    gen, output_types=(tf.int32, tf.int32))
  .batch(8)
  .repeat()
  .make_one_shot_iterator()
  .get_next()
)

sess = tf.InteractiveSession()
sess.run(batch)
你会像这样打印邮件吗

中忽略的异常:
回溯(最近一次呼叫最后一次):
文件“C:\Users\user209974\AppData\Local\Continuum\miniconda3\envs\tf\lib\site packages\tensorflow\python\data\util\nest.py”,第100行,输入值
收益率
SystemError:返回错误,未设置异常
调用
会话时会在运行时引发错误。显然,每次调用生成器时都会运行
。但奇怪的是,尽管抛出了这个错误,返回的值似乎是正确的

那么,是什么导致了这个错误以及如何消除它呢?(由于某些原因,在
gen
中删除批处理或返回单个值会使错误消失)

编辑


我意识到这些错误在PyCharm下以调试模式运行时会出现。如果我在python控制台中以脚本的形式运行代码,或者在PyCharm中但不是在调试模式下运行代码,则不会打印这些消息。

这似乎是PyCharm的问题。解决方案是在pycharm设置中设置此环境变量:

PYDEVD_USE_FRAME_EVAL=NO