0
我一直在阅读Theano文档的扫描,发现自己被两个看似矛盾的陈述所困惑。什么时候使用theano的扫描功能是有利的
在http://deeplearning.net/software/theano/tutorial/loop.html#scan,扫描的优势之一被列为:
Slightly faster than using a for loop in Python with a compiled Theano function.
但是,在http://deeplearning.net/software/theano/library/scan.html#lib-scan,在部分优化使用扫描的,它说:
Scan makes it possible to define simple and compact graphs that can do
the same work as much larger and more complicated graphs. However, it
comes with a significant overhead. As such, **when performance is the
objective, a good rule of thumb is to perform as much of the computation
as possible outside of Scan**. This may have the effect of increasing
memory usage but can also reduce the overhead introduces by using Scan.
我在这里,“表演”的阅读是速度的代名词。所以,一旦编译完成后,我会感到困惑,因为扫描是否会导致运行时间缩短。
对于在脚本写入时其值不可用的符号变量,是否有某种方法可以用运行时计算该变量值的theano函数替换该变量? – user1245262