Skip to content

Instantly share code, notes, and snippets.

@Marina-Miranovich
Created November 14, 2018 21:04
Show Gist options
  • Save Marina-Miranovich/1b20bc6a1fa1876cbdc524c1ad6a6915 to your computer and use it in GitHub Desktop.
Save Marina-Miranovich/1b20bc6a1fa1876cbdc524c1ad6a6915 to your computer and use it in GitHub Desktop.
code_snippet_12 for "Playing Mortal Kombat with TensorFlow.js. Transfer learning and data augmentation" translation
const model = tf.sequential();
model.add(tf.layers.inputLayer({ inputShape: [1024] }));
model.add(tf.layers.dense({ units: 1024, activation: 'relu' }));
model.add(tf.layers.dense({ units: 3, activation: 'softmax' }));
await model.compile({
optimizer: tf.train.adam(1e-6),
loss: tf.losses.sigmoidCrossEntropy,
metrics: ['accuracy']
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment