.expandDims(2)// Shape: (28, 28, 1) - network expects 3d values with channels in the last dimension
.expandDims()// Shape: (1, 28, 28, 1) - network makes predictions for "batches" of images
.toFloat();// Network works with floating points inputs
returntensor.div(255.0);// Normalize [0..255] values into [0..1] range
}
result=tf.argMax(predictions).data();// this will run whenever "predictions" updates
bestGuess=labels[result];// this will run whenever "result" updates
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.