【发布时间】:2018-01-27 18:18:40
【问题描述】:
Shell 重新启动而不打印输出。
import tensorflow as tf
from tensorflow.python.client import timeline
a = tf.random_normal([2000, 5000])
b = tf.random_normal([5000, 1000])
res = tf.matmul(a, b)
print ('aaaaaaaaaaaaaaa')
with tf.Session() as sess:
# add additional options to trace the session execution
options = tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE)
run_metadata = tf.RunMetadata()
sess.run(res, options=options, run_metadata=run_metadata)
print ('bbbbbbbbb')
# Create the Timeline object, and write it to a json file
fetched_timeline = timeline.Timeline(run_metadata.step_stats)
chrome_trace = fetched_timeline.generate_chrome_trace_format()
with open('timeline_01.json', 'w') as f:
f.write(chrome_trace)
Python idle 不打印输出但总是打印:
================== RESTART: C:\Users\hirplk\Desktop\test.py ==================
aaaaaaaaaaaaaaa
=============================== RESTART: Shell ===============================
每当我运行任何代码时都会发生这种情况。这有什么具体问题吗?这发生在我最近多次安装 tensorflow 之后。
【问题讨论】:
-
只是把我的便士扔到一个老问题上,如果你将 C++ 代码绑定到 python 库(Boost.Python 或 Pybind11),那么一个未捕获的异常,如 C++ 中的段错误会导致
RESTART: Shell。只是为了防止将来给其他人造成混淆
标签: python shell tensorflow python-idle