Concatante k linear layers results to single output tensor

I have 14 classification blocks each one is: 1024 → 1.
I wish to concatenate the 14 results to form a 1-D output as if I had 1024 → 14 classes.

prior_layers = []
    for l in LABELS:
         prior_layers.append(LinearAttentionPriorBlock(l, normalize_attention=normalize_attention))

then in the forward pass I would have something like:

res = []
    for l in LABELS:

and each entry int res will be batchX1 is it possible to get the desired results as if it was standard classification or the only way is to output 14 values from the forward pass.

You could do something like

torch.stack(res, dim = 1)

that should output the thing you are looking for.

1 Like

Great, that exactly what I was missing.