ชุดข้อมูล TensorFlow: ชุดข้อมูลชุดพร้อมใช้งาน

ชุดข้อมูล TensorFlow คือชุดของชุดข้อมูลที่พร้อมใช้งาน กับ TensorFlow หรือเฟรมเวิร์ก Python ML อื่นๆ เช่น Jax ชุดข้อมูลทั้งหมดถูกเปิดเผยเป็น tf.data.Datasets ซึ่งทำให้ไพพ์ไลน์อินพุตที่ใช้งานง่ายและมีประสิทธิภาพสูง ในการเริ่มต้นใช้งาน โปรดดู คำแนะนำ และ รายการชุดข้อมูลของ เรา
import tensorflow as tf
import tensorflow_datasets as tfds

# Construct a tf.data.Dataset
ds = tfds.load('mnist', split='train', shuffle_files=True)

# Build your input pipeline
ds = ds.shuffle(1024).batch(32).prefetch(tf.data.AUTOTUNE)
for example in ds.take(1):
  image, label = example["image"], example["label"]
เรียกใช้ใน โน้ตบุ๊ก