Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix frule for static array constructor that converts eltype #275

Merged
merged 2 commits into from
Mar 5, 2024

Conversation

oxinabox
Copy link
Member

@oxinabox oxinabox commented Mar 5, 2024

Previously for the convertable case this errored with

  DimensionMismatch: No precise constructor for SVector{3, Float64} found. Length of input was 1

This does make use of the general assumption of ChainRulesCore that Number's are their own tangent type.
But I think that is fine, that assumption exists in a whole bunch of places and if you violate it you should expect suffering.

src/extra_rules.jl Show resolved Hide resolved
@test ẏ == @SVector [0.0, 0.0, 0.0]
end

@testset "convertable type" begin
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this case different than the first?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first element of x is an Int rather than an Float64

test/extra_rules.jl Outdated Show resolved Hide resolved
@staticfloat staticfloat merged commit 6ce9178 into main Mar 5, 2024
3 checks passed
@oscardssmith oscardssmith deleted the ox/st_con branch March 6, 2024 00:13
@oxinabox
Copy link
Member Author

oxinabox commented Mar 6, 2024

cool and I see you have pushed this to the for_cedar branch also

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants