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