I would like to manually define connections in neural network between layers using TensorFlow and keras with Python. By default connections are beween all pairs of neurons. I need to make connections as in picture below.enter image description here


1 Answer 1


If I understand you correctly, to join two output layers into the next layer input, use the following design:

out1 = keras.layers.YourLayer1(**params**)
out2 = keras.layers.YourLayer2(**params**)
NextLayer = keras.layers.YourLayer3(**params**)[out1, out2]

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.