MNIST Example - Tensorflow Typing CST Test
Loading…
MNIST Example — Tensorflow Code
Train a simple MNIST digit classifier using TensorFlow.
import tensorflow as tf
mnist = tf.keras.datasets.mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train, x_test = x_train/255.0, x_test/255.0
model = tf.keras.Sequential([
tf.keras.layers.Flatten(input_shape=(28,28)),
tf.keras.layers.Dense(128, activation='relu'),
tf.keras.layers.Dense(10, activation='softmax')
])
model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])
model.fit(x_train, y_train, epochs=5)
model.evaluate(x_test, y_test)Tensorflow Language Guide
TensorFlow is an open-source, end-to-end platform for machine learning developed by Google. It provides comprehensive tools, libraries, and community resources for building and deploying ML models across different environments.
Primary Use Cases
- ▸Deep learning for image, video, and speech recognition
- ▸Natural language processing and translation
- ▸Reinforcement learning for AI agents
- ▸Time series forecasting and predictive analytics
- ▸Deployment of AI models on cloud, mobile, and embedded devices
Notable Features
- ▸Flexible computation graphs for ML models
- ▸Support for CPU, GPU, and TPU acceleration
- ▸TensorFlow Extended (TFX) for production pipelines
- ▸TensorFlow Lite for mobile and embedded deployment
- ▸TensorFlow.js for running ML in the browser
Origin & Creator
TensorFlow was created by the Google Brain team and released in 2015 to provide a flexible, scalable platform for machine learning.
Industrial Note
TensorFlow is widely adopted in industry and academia for scalable ML solutions, serving AI applications in computer vision, NLP, recommendation systems, and robotics.