-
Notifications
You must be signed in to change notification settings - Fork 43
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
compatibility with LazyArrays #925
Comments
Probably we want to apply this wrapper automatically, so we need to add methods to whatever the constructor of your So that: (The principle here is that DD aggressively rewraps other constructors to be the outer wrapper wherever it can, without user intervention) |
Ideally I think something like What |
I don't think |
The other way around doesn't work because the expression Another option is to handle all of this within the So It'd be very easy to implement, we'd just need to add something like if lazy
broadcast_expr = quote
bc = Base.Broadcast.instantiate(LazyArrays.lazy.($broadcast_expr))
rebuild(first(vars); data = LazyArray(bc), dims)
end
end |
It's also a bit weird as we mostly have disk arrays for lazyness, and this laziness may be broken on disk arrays depending how the broadcast styles work out. People will think it means lazy on disk too, but it doesnt |
In Rasters, yes. But now that I agree this could potentially be confusing, though. |
Another thing we need for this to work is to move some code from |
And YAX... We can totally integrate with LazyArrays, but there is no way lazy will be a built in keyword for the d macro that means "LazyArrays". |
Maybe materialize=false, if it's just a naming issue? |
Name is one thing, but also putting extensions into default keywords is kinda weird.
|
Is there a reason not to do Won't the broadcasts end up lazy? |
No unfortunately not, because we also need to functionality of Once we have that the wrapping of a LazyArray in a DimArray is the easy bit - which we can do with a dispatch in an extension or just have people do manually. |
Hm... I'm just wondering why (e.g. we only have the |
Yeah it's quite annoying. The design choice is that you can't just wrap an Array in LazyArray to make any operation on it automatically (like with DiskArrays). Instead you have to construct a LazyArray is a result of a broadcast operation. It's not something we're going to be able to change, I guess, but it makes life a lot harder for us. The way to do this without the macro is to go Maybe this is something we can change? Is there a reason that in Otherwise I suppose the conclusion is that this needs thought/isn't possible right now, I can use my bandaid solution for my own use case, and we now have this issue as documentation for anyone who's trying the same thing. |
Ok, yeah that's not great design, I would make an issue there too. It should work like DiskArrays, whicu is really composable even though it does so much more than LazyArrays We could limit how much _maybe_dimensional_broadcast is applied by passing out a flag for if we found a broadcast lower down. Or maybe it can let more things through without wrapping. It will just take some care |
It could be nice to make dimensionaldata and LazyArrays.jl work together. It would probably need an extension. Currently everything I've tried with the
@d
macro returns errors somewhere and I don't really understand how their@~
macro works. But just to demonstrate some potential use cases I've implemented a wrapper to generate a DimArray with a LazyArray parent:Something like this could be a neat way of getting some really big dimarrays with minimal overhead:
The text was updated successfully, but these errors were encountered: