JuliaDiff / JuliaDiff/ChainRulesTestUtils.jl
Limitations of `FiniteDifferences.to_vec` for `Tangent()`
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 50
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
to_vec is great for working on complex structures but it has the limit of only reconstructing the primal representation.
For example, related to #270 , if I had a to_vec(x::AbstractVector{T,Missing}) where {T} definition such as:
function to_vec(x::AbstractVector{T,Missing}) where {T}
is = findall(ismissing, x)
not_is = findall(!ismissing, x)
xval, from_xval = to_vec(x[is])
function from_vec(x)
y = similar(x)
y[is] = from_xval(x)
y[not_is] .= missing
y
end
xval, from_vec
end
The primal reconstruction would work fine, but instead of returning some NoTangent for the missing values, it would just return missing and mess up the rest.
One solution would be to specify a dual version which would put the right Tangent types where needed.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the implementation of FiniteDifferences.to_vec and the context in #270. Determine how a dual reconstruction should represent missing values without replacing required Tangent or NoTangent values; done means the proposed behavior is specified and covered by relevant tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100