Challenge - 5 Problems
TensorFlow.js Conversion Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of TensorFlow.js model prediction after conversion
Given a TensorFlow model converted to TensorFlow.js format and loaded in the browser, what will be the output shape of the prediction for an input tensor of shape [1, 28, 28, 1]?
TensorFlow
const input = tf.zeros([1, 28, 28, 1]); const model = await tf.loadLayersModel('model.json'); const prediction = model.predict(input); prediction.shape;
Attempts:
2 left
💡 Hint
Think about the output layer size of a typical classification model for 10 classes.
✗ Incorrect
The model outputs predictions for 10 classes, so the output shape for a single input is [1, 10].
❓ Model Choice
intermediate2:00remaining
Choosing the correct TensorFlow.js model format for conversion
Which TensorFlow saved model format is compatible for direct conversion to TensorFlow.js using the tensorflowjs_converter tool?
Attempts:
2 left
💡 Hint
The converter expects a full SavedModel directory structure.
✗ Incorrect
The tensorflowjs_converter tool accepts the TensorFlow SavedModel directory format for conversion.
❓ Hyperparameter
advanced2:00remaining
Effect of quantization during TensorFlow.js model conversion
What is the main effect of applying 8-bit quantization during TensorFlow.js model conversion?
Attempts:
2 left
💡 Hint
Quantization trades precision for smaller size and faster speed.
✗ Incorrect
8-bit quantization reduces model size and speeds up inference but may slightly reduce accuracy.
🔧 Debug
advanced2:00remaining
Identifying error when loading a TensorFlow.js model
You try to load a TensorFlow.js model with tf.loadLayersModel('model.json') but get a 404 error. What is the most likely cause?
Attempts:
2 left
💡 Hint
A 404 error means the file was not found at the specified URL.
✗ Incorrect
A 404 error indicates the model.json file path is wrong or the file is missing on the server.
🧠 Conceptual
expert3:00remaining
Understanding the difference between TensorFlow.js Layers and Graph models
Which statement correctly describes the difference between TensorFlow.js Layers API models and Graph models?
Attempts:
2 left
💡 Hint
Think about abstraction levels and flexibility.
✗ Incorrect
Layers API provides a user-friendly way to build models; Graph models allow loading any TensorFlow graph for inference.