A Pen by Shanqing Cai on CodePen.
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
// To see the callback live, uncomment the following lines for and try the | |
// code out with ts-node. | |
// (async function() { | |
// const model = tfl.sequential({layers: [ | |
// tfl.layers.dense({units: 100, inputShape: [20], activation: 'relu'}), | |
// tfl.layers.dense({units: 1}) | |
// ]}); | |
// model.compile({loss: 'meanSquaredError', optimizer: 'sgd'}); | |
// const xs = tfc.ones([500, 20]); |
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
import time | |
import tensorflow as tf | |
tf.enable_eager_execution() | |
# with tf.device('gpu:0'): | |
def model(xs): | |
ys = tf.keras.layers.Conv2D(8, [2, 8], activation='relu')(xs) | |
ys = tf.keras.layers.MaxPool2D([2, 2], strides=[2, 2])(ys) |
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
const tf = require('@tensorflow/tfjs'); | |
require('@tensorflow/tfjs-node-gpu'); | |
(async function() { | |
const inputShape = [43, 232, 1]; | |
const numClasses = 10; | |
const model = tf.sequential(); | |
model.add(tf.layers.conv2d({ | |
filters: 8, kernelSize: [2, 8], |
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
import keras | |
import tensorflowjs as tfjs | |
model = keras.applications.mobilenet.MobileNet(alpha=0.25) | |
tfjs.converters.save_keras_model(model, '/tmp/mobilnet_0.25') |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.