now slave correctly gets data

This commit is contained in:
2019-12-01 10:21:58 -08:00
parent 569bbf7397
commit b115077c3b
3 changed files with 31 additions and 23 deletions

View File

@@ -34,15 +34,17 @@ def create_mnist_network():
return model
def create_cbow_network(win, vocsize, embed):
def create_cbow_network(win, embed):
ctxt = tf.keras.layers.Input(shape=[win])
ed = tf.keras.layers.Embedding(vocsize, embed, input_length=win)(ctxt)
avgd = tf.keras.layers.Lambda(lambda x: tf.reduce_mean(x, axis=1))(ed)
mod = tf.keras.Model(inputs=ctxt, outputs=avgd)
ed = tf.keras.layers.Embedding(len(vocab), embed, input_length=win)(ctxt)
cbow = tf.keras.layers.Lambda(lambda x: tf.reduce_mean(x, axis=1))(ed)
blowup = tf.keras.layers.Dense(len(vocab), activation='softmax')(cbow)
mod = tf.keras.Model(inputs=ctxt, outputs=blowup)
mod.compile(
optimizer='sgd',
loss='categorical_crossentropy',
)
print(mod, flush=True)
return mod