# Input for multiheaded dense layers in Flux

**URL:** <https://discourse.julialang.org/t/input-for-multiheaded-dense-layers-in-flux/85659>\
**Category:** General Usage\
**Tags:** question, flux\
**Created:** [August 12, 2022, 9:43am UTC](https://discourse.julialang.org/t/input-for-multiheaded-dense-layers-in-flux/85659 "2022-08-12T09:43:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marius\_123](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@Marius\_123](https://discourse.julialang.org/u/Marius_123)\
**Post date:** [August 12, 2022, 9:43am UTC](https://discourse.julialang.org/t/input-for-multiheaded-dense-layers-in-flux/85659/1 "2022-08-12T09:43:23Z")

</div>

Hello,

i have as a input for my neural network basically an array of arrays. Each of these arrays should have seperate input neurons associated to them. A small example can be found below, where my training set has size two and i want to have 3 input heads. This code yields an error since the input for the training has the wrong shape. How do i need to process the input correctly?

```julia
using Flux

m= Chain(Parallel(+; head1 = Dense(4, 2, tanh), head2 = Dense(2, 2), head3 = Dense(3, 2, tanh)),Dense(2,1,tanh))

inputs = [([1,2,3],[4,5], [50,100, 80]),([10,20,30],[40,50], [70,130, 80])]

outputs = randn((1,2))

size(outputs)

data = [(inputs, outputs)]

loss(x, y) = Flux.Losses.mse(m(x), y)

ps = Flux.params(m)

# later

opt = Descent(0.1)

Flux.train!(loss, ps, data, opt)

```
