tensorflow-data-pipelines

Build tf.data pipelines for dataset loading, transformation, batching, and prefetching in TensorFlow.

Updated Feb 27, 2026
One-click install
npx skills add https://github.com/gracefullight/cnn --skill tensorflow-data-pipelines-gracefullight
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: tensorflow-data-pipelines
Source: https://github.com/gracefullight/cnn/tree/main/.agents/skills/tensorflow-data-pipelines
Command: npx skills add https://github.com/gracefullight/cnn --skill tensorflow-data-pipelines-gracefullight

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires tensorflow, numpy.

What problem does it solve? Slow or inefficient data loading leaves GPUs and TPUs idle during training, and ad-hoc NumPy-based loading fails when datasets exceed memory. This Skill provides patterns for building optimized tf.data input pipelines that keep accelerators saturated. ## Core Features & Use Cases - Dataset Creation: Build datasets from tensors, generators, ranges, TFRecord files, CSV files, and image paths. - Transformation & Augmentation: Chain normalization, resizing, and random augmentation with parallel map calls and correct cache placement. - Performance Optimization: Apply shuffling, batching, prefetching with tf.data.AUTOTUNE, interleaving, and memory-efficient train/validation splits. - Use Case: When training an image classifier on a dataset too large for RAM, construct a pipeline that reads image files in parallel, caches preprocessed tensors, applies random augmentation, and prefetches batches so the GPU never waits for data. ## Quick Start Ask the AI to create an optimized tf.data pipeline that loads images from disk, applies augmentation, and prefetches batches for model training.

Frequently Asked Questions about tensorflow-data-pipelines

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a tf.data pipeline in TensorFlow?▼

Create a dataset with tf.data.Dataset.from_tensor_slices or from_generator, then chain transformations: map for preprocessing, shuffle for randomization, batch for grouping, and prefetch with tf.data.AUTOTUNE at the end to overlap loading with training.

How to optimize tf.data pipeline performance?▼

Add prefetch(tf.data.AUTOTUNE) as the final step, use num_parallel_calls=tf.data.AUTOTUNE in map operations, and place cache() after expensive preprocessing but before augmentation. Shuffle before batching with a buffer of several thousand elements.

Does tf.data support TFRecord and CSV files?▼

Yes. Use tf.data.TFRecordDataset with tf.io.parse_single_example for TFRecord shards, and tf.data.TextLineDataset with tf.io.decode_csv for CSV files. Both support parallel parsing via map with num_parallel_calls.

Why is my GPU idle during TensorFlow training?▼

GPU idleness usually means the input pipeline is the bottleneck. Common causes are missing prefetch(), sequential map operations without num_parallel_calls, or expensive preprocessing done on every epoch instead of being cached.

When should I not cache a tf.data dataset?▼

Avoid caching when the dataset exceeds available memory, since cache() stores all elements in RAM or on disk. Also never cache after random augmentation, because it freezes the augmented values and removes per-epoch randomness.