make rand_tangent of struct with no perturbable fields return DoesNotExist#158
make rand_tangent of struct with no perturbable fields return DoesNotExist#158
Conversation
| Composite{T}(; NamedTuple{field_names}(tangents)...) | ||
| end | ||
| else | ||
| return NO_FIELDS |
There was a problem hiding this comment.
The outer if here that gives us the NO_FIELDS would be able to be removed if we replaced NO_FIELDS with DoesNotExist().
Since then we would be in the case that all the fields (of which there are none) subtype DoesNotExist.
Vacuous truth.
|
Also closes #153 |
|
Actually, it won't close any of the issues, because we still have two copies of rand_tangent (one here and one in ChainRulesTestUtils). |
It won't close that julia> rand_tangent(Random.GLOBAL_RNG, Colon())
ChainRulesCore.Zero()It would close that if we also did
|
|
Oh yeah that's right, my bad. I am happy to move the code over and make it work. We discussed on slack a while back. |
|
Thanks. |
|
I think we can merge this now since JuliaDiff/ChainRulesTestUtils.jl#147 is in |
|
Well, actually, needs a version bump, not sure why it does not show up as conflict. |

Closes #149
This is my preferred alternative to JuliaDiff/ChainRulesTestUtils.jl#142 (comment)
Note that it is not the case that if all my fields do not exist then i do not exist,
but it is the case that if all my fields are not perturbable then I am not pertablable.
Which is what
DoesNotExistactually means, and we should rename it.