TensorFlow (Google) framework học máy mã nguồn mở, tối ưu NumPy/tensor, scalable, GPU, tài liệu tốt.
Cài đặt: pip install tensorflow
Tensor: mảng đa chiều trong đồ thị luồng dữ liệu.
Sử dụng Jupyter Notebook: pip install tensorflow.

Ví dụ
import tensorflow as tf
import numpy as np
matrix_1 = np.array([(1,2,3),(3,2,1),(1,1,1)], dtype='int32')
matrix_2 = np.array([(0,0,0),(-1,0,1),(3,3,4)], dtype='int32')
print("Ma trận 1:", matrix_1)
print("Ma trận 2:", matrix_2)
matrix_1 = tf.constant(matrix_1)
matrix_2 = tf.constant(matrix_2)
matrix_prod = tf.matmul(matrix_1, matrix_2)
print("Tích ma trận:", matrix_prod)
Đầu ra
Ma trận 1: [[1 2 3] [3 2 1] [1 1 1]] Ma trận 2: [[ 0 0 0] [-1 0 1] [ 3 3 4]] Tích ma trận: tf.Tensor( [[ 7 9 14] [ 1 3 6] [ 2 3 5]], shape=(3, 3), dtype=int32)
Giải thích
- Import TensorFlow, NumPy.
- Tạo 2 ma trận 3x3 NumPy, chuyển sang
tf.constant. tf.matmulthực hiện nhân ma trận chuẩn (dot product).- Kết quả ma trận 3x3.