Last active
May 29, 2018 19:31
-
-
Save kgrm/e0741af9fda6ee7b04871d10f6a1d811 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keras.layers import Input, Dense, Lambda | |
from keras.models import Model | |
def eucl_dist(inputs): | |
x, y = inputs | |
return ((x - y)**2).sum(axis=-1) | |
x = Input((32,)) | |
y1 = Dense(8)(x) | |
y2 = Dense(8)(x) | |
y = Lambda(eucl_dist, output_shape=(1,))([y1, y2]) | |
m = Model(x, y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment