Avoid Elemwise fusion for scalar Ops without C implementations #161
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue involving the fusion of
Elemwise
Op
s with scalarOp
s that do not haveOp.c_code
implementations.There were no direct tests for the relevant condition in
local_elemwise_fusion_op
(i.e. thereturn
missing from within here), so, naturally, this issue went unnoticed. It's possible—albeit doubtful—that there were even any indirect tests for this (whether intentional or not).This is yet another great example of how badly we need to refactor the tests (e.g. #141, #23, etc.) and dramatically change the testing standards. For example, the test added in this PR creates its own
Op
that lacks ac_code
method; had we used an existingOp
that lacked ac_code
method (e.g.theano.tensor.basic.i0
) we would've implicitly added an unnecessary testing dependency/requirement, and, in the somewhat likely event that ac_code
implementation is given to saidOp
, the entire test would've been silently invalidated.Likewise, the same test attempts to force C compilation and explicitly includes the relevant optimizations; however, many tests in that module simply assume that the optimizations they're testing are enabled in the default mode object (e.g.
mode_opt
intests.tensor.test_opt
). This approach is confounded by all the other optimizations enabled in the default/global mode, and it makes all the tests that rely on it brittle and highly dependent on those other unrelated optimizations.Closes #160.