tensorflow-data-pipelines

Build efficient tf.data pipelines with batching, shuffling, and prefetching.

187|20|Updated Nov 20, 2025
One-click install
npx skills add https://github.com/TheBushidoCollective/han --skill tensorflow-data-pipelines
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tensorflow-data-pipelines
Source: https://github.com/TheBushidoCollective/han/tree/main/jutsu/jutsu-tensorflow/skills/tensorflow-data-pipelines
Command: npx skills add https://github.com/TheBushidoCollective/han --skill tensorflow-data-pipelines

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill teaches building efficient data pipelines using tf.data, including batching, shuffling, prefetching, and advanced optimizations.

Core Features & Use Cases

  • Dataset creation: from_tensor_slices, from_generator, from_dataset.
  • Transformations: map, batch, shuffle, cache, prefetch.
  • Performance: Prefetching and optimized batching for GPU/TPU.

Quick Start

Create a batched, prefetched dataset from numpy arrays 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 optimize data pipelines for TensorFlow model training?

Optimize TensorFlow data pipelines using tf.data transformations: batching groups samples efficiently, prefetching overlaps data loading with GPU computation, and shuffling randomizes training order. Cache frequently-accessed datasets and apply map transformations for normalization and augmentation to reduce bottlenecks and maximize GPU/TPU utilization during training.

What's the best way to create and transform datasets with tf.data?

Create datasets using tf.data sources like from_tensor_slices for numpy arrays, from_generator for custom data, or from_dataset to combine sources. Apply transformations in sequence: map for preprocessing, batch to group samples, shuffle for randomization, and cache to store intermediate results, building efficient pipelines from raw data to model-ready batches.

Can I use prefetching and batching together to speed up training?

Yes. Prefetch loads the next batch while the GPU processes the current one, eliminating idle time. Combine prefetching with optimized batching and cache operations to overlap data preparation with model computation, significantly reducing training time on GPU and TPU hardware.

When should I use tf.data instead of loading all data into memory?

Use tf.data pipelines when datasets exceed available RAM, when training requires dynamic augmentation, or when you need fine-grained control over batching and prefetching. tf.data handles streaming, shuffling, and prefetching efficiently without loading entire datasets upfront, enabling scalable training on large or continuous data sources.

What are common data pipeline bottlenecks in TensorFlow training?

Common bottlenecks include slow data loading without prefetching, inefficient batch sizes, missing cache operations on transformed data, and inadequate shuffling configurations. tf.data pipelines address these through prefetch to overlap I/O, optimized batching for hardware utilization, cache for repeated access, and shuffle for randomization.

How do I handle normalization and augmentation in tf.data pipelines?

Apply normalization and augmentation using the map transformation, which applies custom functions to each sample or batch. Define preprocessing functions for normalization and augmentation logic, then use dataset.map() to scale operations across the entire pipeline, ensuring consistent preprocessing during training.