-
Notifications
You must be signed in to change notification settings - Fork 34
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
feat: Preserve Indices When Copying Tracked Arrays #263
Conversation
Bumping :) |
@@ -55,6 +55,9 @@ end | |||
function Base.convert(::Type{ComponentArray{T1,N,A1,Ax1}}, x::ComponentArray{T2,N,A2,Ax2}) where {T1,T2,N,A1,A2,Ax1,Ax2} | |||
return T1.(x) | |||
end | |||
function Base.convert(::Type{ComponentArray{T,N,A1,Ax1}}, x::ComponentArray{T,N,A2,Ax2}) where {T,N,A1,A2,Ax1,Ax2} | |||
return x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't we want the axes to be from the type we're converting to? I think part of the contract of convert
is that the output needs to be of the type you're converting to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It follows the same pattern as some of the other dispatches
function Base.convert(::Type{ComponentArray{T,N,A,Ax1}}, x::ComponentArray{T,N,A,Ax2}) where {T,N,A,Ax1,Ax2} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in those dispatches we'd want to just have Ax
instead of Ax1
and Ax2
too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed! I do not know if there are downstream packages relying on that behaviour, so I will not touch those dispatches in this PR. For now, I have matched the axes for this dispatch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I definitely need to change those, then. But that doesn't block this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have also had to add another trivial dispatch to avoid ambiguities.
Sorry, I commented this morning but forgot to hit "Submit Review" |
Bump :) |
Ref failures in https://github.com/SciML/SciMLSensitivity.jl/actions/runs/9669459445/job/26676007518?pr=1057