Skip to content

Instantly share code, notes, and snippets.

@Marina-Miranovich
Created November 14, 2018 20:37
Show Gist options
  • Save Marina-Miranovich/1704553e494389356609f645c6d66dea to your computer and use it in GitHub Desktop.
Save Marina-Miranovich/1704553e494389356609f645c6d66dea to your computer and use it in GitHub Desktop.
code_snippet_2 for "Playing Mortal Kombat with TensorFlow.js. Transfer learning and data augmentation" translation
import * as tf from '@tensorflow/tfjs';
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: 1, activation: 'sigmoid' }));
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