DEV Community 👩‍💻👨‍💻

Mohamed Bakrey
Mohamed Bakrey

Posted on

Introduction to TensorFlow 2

Hello TensorFlow!

How to import tensorflow.

# Import TensorFlow
import tensorflow as tf

Loading the image

print('Loading data...\n')
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()
print('MNIST dataset loaded.\n')

creat the model

x_train = x_train/255.
model = tf.keras.models.Sequential([
tf.keras.layers.Dense(16, activation='relu'),
tf.keras.layers.Dense(10, activation='softmax')

make compile for the model


Make Fit foe the model

print('Training model...\n'), y_train, epochs=3, batch_size=32)
print('Model trained successfully!')

Oldest comments (0)

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.