在 tensorflow 1.2.1 中导入 tensorflow contrib 模块很慢 [英] Import tensorflow contrib module is slow in tensorflow 1.2.1
问题描述
1.2.1 中的 tensorflow contrib 模块导入比 1.1.0 慢是否有原因?我使用的是 Python 3.5.
Is there a reason for the tensorflow contrib module imports being slower in 1.2.1 than 1.1.0? I am using Python 3.5.
使用命令行的开销并不大,大约 2-3 秒.然而,在 IDE 中,它变得非常重要(导入 tensorflow.contrib 大约需要 10 秒,而不是在 tensorflow 1.1.0 中(大约 0.5 秒).
The overhead is not significant using the command-line, its perhaps around 2-3 seconds. However in an IDE, it becomes quite significant (~ 10 seconds to import tensorflow.contrib as opposed to (~0.5 seconds) in tensorflow 1.1.0.
提前致谢.
推荐答案
导入很慢,因为它做了很多次inspect.stack()
,每次都需要很多时间.我已经报告了这个问题,并且已经提交了一个带有修复的 PR.
It is slow to import because it is doing inspect.stack()
many times, which take a lot of time each time. I have reported this issue, and have submitted a PR with a fix.
这篇关于在 tensorflow 1.2.1 中导入 tensorflow contrib 模块很慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!