Suppose I want to compare two images with deep convolutional NN. How can I implement two different pathways with the same kernels in keras?
Like this:
Indeed using the same (instance of) layer twice ensures that the weights will be shared.
Just look at the siamese example, I just put here an excerpt from the model to show an example:
# because we re-use the same instance `base_network`,
# the weights of the network
# will be shared across the two branches
processed_a = base_network(input_a)
processed_b = base_network(input_b)