tensorflow-neural-networks

Build and train neural networks using TensorFlow Keras APIs and custom layer implementations.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires tensorflow, numpy.

What problem does it solve? Designing and training neural networks in TensorFlow involves many decisions—choosing between Sequential, functional, and subclassing APIs, implementing custom layers, configuring training loops, and avoiding common pitfalls like wrong loss functions or unnormalized data. This Skill provides working code patterns for the full range of TensorFlow model-building tasks. ## Core Features & Use Cases - Sequential and CNN Models: Ready-to-use Keras Sequential architectures for image classification on MNIST and CIFAR-10, including convolutional blocks with batch normalization and dropout. - Custom Layers and Models: Subclassing patterns for custom Dense layers, residual blocks, multi-task models with shared representations, and low-level tf.Module implementations. - Recurrent Networks: Custom GRU cell and embedding-based RNN implementations using TensorFlow NumPy for sequence modeling. - Use Case: When you need to build a multi-output model that shares convolutional feature extractors across two classification tasks, use the MultiTaskModel subclassing pattern and compile it with per-task losses. ## Quick Start Ask the AI to build a TensorFlow CNN image classifier for your dataset using the Keras Sequential API with dropout and batch normalization.

Frequently Asked Questions about tensorflow-neural-networks

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

FAQPage Schema
How do I build a neural network with TensorFlow Keras?▼

Use the Sequential API to stack layers linearly, then call model.compile with an optimizer, loss function, and metrics before training with model.fit. For image classification, combine Dense or Conv2D layers with Dropout and BatchNormalization.

How to create a custom layer in TensorFlow?▼

Subclass tf.keras.layers.Layer and implement build() to create weights with add_weight, and call() for the forward pass. Override get_config() to enable model serialization so the layer can be saved and loaded.

When should I use model subclassing vs the Sequential API?▼

Use Sequential for simple linear stacks of layers. Switch to subclassing tf.keras.Model when you need multiple outputs, shared layers across tasks, residual connections, or dynamic forward-pass logic that the Sequential API cannot express.

Why does my TensorFlow model fail with categorical_crossentropy?▼

categorical_crossentropy expects one-hot encoded labels, so integer labels cause errors. Use sparse_categorical_crossentropy for integer class labels, or convert labels with tf.keras.utils.to_categorical before training.

Does TensorFlow support custom RNN cells like GRU?▼

Yes, you can implement a custom GRU cell using TensorFlow NumPy operations with tf.Variable weights for update and reset gates. The cell maintains state across timesteps and can be wrapped in a sequential model with embedding and dense layers.

How do I prevent overfitting in Keras models?▼

Add Dropout layers with rates between 0.2 and 0.5, use BatchNormalization for training stability, and monitor validation metrics during fit. EarlyStopping and ModelCheckpoint callbacks help stop training and save the best model.