Repository navigation
Fix MethodError in ifelse when both branches are constants - #325
Conversation
Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #325 +/- ##
=======================================
Coverage 93.81% 93.82%
=======================================
Files 28 28
Lines 1100 1101 +1
=======================================
+ Hits 1032 1033 +1
Misses 68 68 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Maybe we should add a size assertion on both inputs while we are at it. |
|
The scalar |
|
Thanks! :) |
Fixes #314.
ifelse(tracer_cond, c1, c2)where both branches are plain constants (not tracers) hitoutput_unionwith no matching method and threwMethodError: no method matching output_union(::Float64, ::Float64). The existing scalar fallbacks only cover the cases where at least one branch is anAbstractTracer.Added a fallback for when neither branch is a tracer. In that case the result carries no dependency on the inputs, so returning either constant gives the correct (empty) sparsity pattern. Also added a gradient test for the both-constant case next to the existing single-constant ones.