Created
February 15, 2018 15:56
-
-
Save TheLoneNut/044a6b2583541437c3c208986447b082 to your computer and use it in GitHub Desktop.
This file contains 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
in_dims = (N_MINS, n_feat) | |
out_dims = N_FACTORS | |
# Network definition | |
with tf.device(tf_device): | |
# Create the 3 inputs | |
anchor_in = Input(shape=in_dims) | |
pos_in = Input(shape=in_dims) | |
neg_in = Input(shape=in_dims) | |
# Share base network with the 3 inputs | |
base_network = create_base_network(in_dims, out_dims) | |
anchor_out = base_network(anchor_in) | |
pos_out = base_network(pos_in) | |
neg_out = base_network(neg_in) | |
merged_vector = concatenate([anchor_out, pos_out, neg_out], axis=-1) | |
# Define the trainable model | |
model = Model(inputs=[anchor_in, pos_in, neg_in], outputs=merged_vector) | |
model.compile(optimizer=Adam(), | |
loss=triplet_loss) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment