What is the difference between Parallel and Branch combinators in Trax?

91 views Asked by At

I don't understand what's the difference between the Branch and the Parallel combinators. They both seem to apply a list of layers in parallel, the only difference is that Branch applies them to copies of inputs -- what does that mean?

1

There are 1 answers

0
pd0623 On

From the Trax documentation:

For example, suppose one has three layers:
F: 1 input, 1 output
G: 3 inputs, 1 output
H: 2 inputs, 2 outputs (h1, h2)

Then Branch(F, G, H) will take 3 inputs and give 4 outputs:
inputs: a, b, c
outputs: F(a), G(a, b, c), h1, h2 where h1, h2 = H(a, b)

Then Parallel(F, G, H) will take 6 inputs and give 4 outputs:
inputs: a, b, c, d, e, f
outputs: F(a), G(b, c, d), h1, h2 where h1, h2 = H(e, f)