However, this optimization did not work as expected. The total optimization time become 10 times larger:
370.541s for fgraph.validate()
...
1497.519540s - ('inplace_elemwise_optimizer', 'FromFunctionOptimizer', 33) - 315.055s
The origin version:72.644s for fgraph.validate()
...
143.351832s - ('inplace_elemwise_optimizer', 'FromFunctionOptimizer', 34) - 30.064s
After several small optimization pointed out by my mentor, the time become 1178s.
Why is it slower? I think it is because we are trying to apply the optimizer successfully on all nodes. It is a trade-off between the time took by validate() and the number of nodes optimized. In the past, all failed nodes are ignored directly, so it was fast. Now we are trying to apply on them again and again. validate() is called for much more times than before.
Here is a figure I just plotted to display the nodes number to optimize in each iteration.
I'm still working on this. Please tell me if you have any idea.
Thank you.
没有评论:
发表评论