I am trying to group the outputs of my neural network, in order to have them perform a separated classification.
Let's take the example where the groups are constituted of two nodes and we previously have four output nodes, then the network should look like this :
How can I achieve this using Keras or Tensorflow ? I was thinking that I need to implement a custom layer and do the operation inside of it, but I wonder if there is an easier solution using the Keras Functional API (or lower level Tensorflow ?) :)