add_weights function

Add weights to the network.