It is said that the Output layer uses a linear function. What would the weights look like if we want to sum all the elements of the vector a^[1]

I’m not sure if I’m understanding your question properly – are you asking how to set the weights such that a^[2] = a0^[1] + a1^[1] + a2^[1]?

a^[2] = w0^[2]a0^[1] + w1^[2]a1^[1] + w2^[2]a2^[1] + b^[2], so you would do this by setting all values in w^[2] to 1, and b^[2] to 0.

EDIT: I’m not sure how the formatting of what I typed above came out – sorry if it looks like a hot mess. The quick answer is to set all the weights in w[2] to 1, and set the constant b[2] to 0.

@bs80, I added some backslashes to fix them.