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,4,5)], dtype='int32')
matrix_2 = np.array([(-1,0,1,3,3)], 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.multiply(matrix_1, matrix_2)
print("Tích từng phần tử:", matrix_prod)
Đầu ra
Ma trận 1: [[1 2 3 4 5]] Ma trận 2: [[-1 0 1 3 3]] Tích từng phần tử: tf.Tensor([[-1 0 3 12 15]], shape=(1, 5), dtype=int32)
Giải thích
- Import TensorFlow, NumPy.
- Tạo 2 ma trận NumPy, chuyển sang
tf.constant. tf.multiplynhân element-wise (phần tử tương ứng).- Kết quả: [-1, 0, 3, 12, 15].