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

Parallel never calls apply #1160

Open
ExpandingMan opened this issue Jan 3, 2025 · 5 comments
Open

Parallel never calls apply #1160

ExpandingMan opened this issue Jan 3, 2025 · 5 comments

Comments

@ExpandingMan
Copy link

The Parallel layer never calls Lux.apply, but only calls its own method Lux.applyparallel. The problem with this is that if you try to overload methods of apply to implement your own input types as described here, Parallel will just completely ignore it.

I would suggest keeping applyparallel as is but first adding an extra indirection via apply to the call to Parallel.

@avik-pal
Copy link
Member

avik-pal commented Jan 3, 2025

it calls it here:

[:(($(y_symbols[i]), $(st_symbols[i])) = @inline apply(

@ExpandingMan
Copy link
Author

Right, but it's only calling it for the child layers not for Parallel itself, right?

@avik-pal
Copy link
Member

avik-pal commented Jan 3, 2025

The apply calls are redirected from LuxCore. apply(m, x, ps, st) -> m(x, ps, st) -> applyparallel(m, x, ps, st)

@ExpandingMan
Copy link
Author

If apply calls m, shouldn't one overload m directly then instead of apply? The main issue I mean to raise here is that if one follows the instructions in the docs for creating custom input types, it passes the input through Parallel into its arguments without first executing the overloaded code on Parallel, which leads to unexpected results.

@avik-pal
Copy link
Member

avik-pal commented Jan 3, 2025

overloading m will lead to method ambiguities in most cases. Can you give a MWE for this case?

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

No branches or pull requests

2 participants