Add Residual Connections To Output

Hi There! I’m currently trying to figure out how to add a residual connection to my out layer. Essentially, I want every neuron in the hidden layers to be connected to the output neuron.

I’m currently making a sequential layer for every hidden layer and at the end of my forward pass, I am adding all the outputs up and making that the final output. Does anyone have any recommendations on how to do this? Thank you! (Sorry in advance for all of the code)