-
Notifications
You must be signed in to change notification settings - Fork 20
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
add a type-stable unstack
method with Val
dims arg
#150
Conversation
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #150 +/- ##
==========================================
+ Coverage 88.40% 88.46% +0.05%
==========================================
Files 13 15 +2
Lines 595 598 +3
==========================================
+ Hits 526 529 +3
Misses 69 69
... and 2 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Instead of forcing it to be a positional arg, you can do what Base does with |
I was trying to copy the idea from @inline unstack(xs...; dims) = _unstack(dims, xs...)
_unstack(dims, xs...) = _unstack_t(dims, Base.promote_eltypeof(xs...), xs...)
dims2unstack(::Val{dims}) where dims = dims2unstack(dims)
dims2unstack(dims::Integer) = dims
@inline function _unstack_t(dims, ::Type{T}, xs...) where {T}
unstackdims = dims2unstack(dims)
[copy(selectdim(xs..., unstackdims, i)) for i in 1:size(xs..., unstackdims)]
end I'll continue trying to make this work tomorrow. |
Given @inline unstack(xs; dims) = _unstack(dims, xs)
@inline dims2unstack(::Val{dims}) where dims = dims2unstack(dims)
@inline dims2unstack(dims::Integer) = dims
@inline _unstack(dims, xs) = [copy(selectdim(xs, dims2unstack(dims), i)) for i in axes(xs, dims2unstack(dims))] I don't think |
The only check that that failed was on Julia nightly and doesn't seem to be related to the changes in this PR. Should I do anything else? |
Co-authored-by: Brian Chen <ToucheSir@users.noreply.github.com>
Thanks! I commited your suggestion for removing that |
Wait for one of the maintainers to have a break from or finish work? If you don't hear anything after 24-48 hours, that's a better time to bump. |
OK, I apologize; I didn't mean to rush or bother you. I just wasn't sure if there was anything else I needed to do on my end. I thank you very much for your assistance, and I'm truly sorry for any inconvenience. |
No need to apologize. My point is that open source dev means that people are all over the world with all sorts of time commitments. Longer lead times and very async communication should be the default expectation. |
Addressing #149.