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 Chains and Layers #84

Open
AlCap23 opened this issue Jun 7, 2022 · 2 comments
Open

Parallel Chains and Layers #84

AlCap23 opened this issue Jun 7, 2022 · 2 comments

Comments

@AlCap23
Copy link

AlCap23 commented Jun 7, 2022

As discussed, some Layers for piping a single output into different chains and concat some chains back to a single vector might be useful in the future. A similar layer is also implemented in Flux.jl

A possible implementation might look like

schain = SimpleChain(
  static(24), 
  TurboDense{true}(tanh, 8), 
  SimpleChains.Dropout(0.2), 
  SimpleChains.Parallel(
     (1:5 => 1, 6:8 => 2), # Define that index 1:5 goes to first component, 6:8 to second
     TurboDense{true}(tanh, 8), 
     TurboDense{true}(tanh, 8), 
     sum # Sums up all outputs
  ),
  TurboDense{false}(identity, 2),
  SquaredLoss(y)
);
@willleeney
Copy link

I am also very interested in this! It would be nice if the parallel chain could take multiple inputs, process them in parallel then perform some operation to combine the outputs.

@avik-pal
Copy link
Contributor

Lux wraps SimpleChains https://lux.csail.mit.edu/stable/api/Lux/interop#Lux.SimpleChainsLayer so you can use the layers from there with SimpleChains now

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

3 participants