tf-slim
TensorFlow-Slim: A lightweight library for defining, training and evaluating complex models in TensorFlow
What it is and what it does
TensorFlow-Slim is a lightweight library that sits on top of TensorFlow to reduce boilerplate when building neural networks. It provides argument scoping to set default parameters across operations, high-level layer definitions, variable management utilities that distinguish between model and non-model variables, and pre-built implementations of popular computer vision architectures like VGG and AlexNet. It also includes training and evaluation routines, loss functions, metrics, regularizers, and data-loading utilities.
You use it by importing as `tf_slim` and calling its layers and utilities instead of writing raw TensorFlow operations. It is designed to mix freely with native TensorFlow code, so you can adopt it incrementally. The library targets developers building convolutional neural networks and other deep learning models who want to reduce repetitive code and improve readability.
Use it for:
- Define convolutional neural networks compactly using slim layers instead of native operations
- Reuse pre-trained VGG or AlexNet models as starting points or feature extractors for transfer learning
- Manage model variables separately from training variables for easier checkpoint saving and loading
- Apply regularization and common loss functions without writing custom code
- Train models with built-in learning routines and evaluate using standard metrics
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
TensorFlow-Slim provides high-level layers, variable management, and training utilities that simplify defining, training, and evaluating neural network models in TensorFlow.
Yes, if you are working with TensorFlow 1.x or early TensorFlow 2.x and need to reduce model-definition boilerplate. No, if you are starting a new project—modern TensorFlow and Keras provide equivalent or superior APIs natively. The package is stable and permissively licensed, but has not been updated since 2020 and may not be compatible with the latest TensorFlow versions.
Install
tf-slim on PyPI
pip
pip install tf-slimuv
uv add tf-slimpoetry
poetry add tf-slimInstalling tf-slim
Before you install
Low friction to install; depends only on absl-py. Maintenance is active with recent commits, though the latest release was 2020-05-07 and the package has not received updates for several years despite the repository remaining active.
License in practice
Licensed under Apache 2.0 (permissive), allowing free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
Quickstart
pip install tf-slim
import tf_slim as slim
# Define a model using slim layers and variables
weights = slim.model_variable('weights', shape=[10, 10, 3, 3], initializer=tf.truncated_normal_initializer(stddev=0.1), regularizer=slim.l2_regularizer(0.05))
Requires TensorFlow 1.15.2 or TensorFlow 2.0–2.2; compatibility with TensorFlow versions beyond 2.2 is unverified.
Verify before relying
- Whether version 1.1.0 remains compatible with current TensorFlow releases beyond those tested (TF 1.15.2, 2.0.1, 2.1, 2.2)
- Current status of pre-built models (VGG, AlexNet) and whether they are maintained or deprecated
- Whether this package is still recommended for new projects or superseded by native TensorFlow APIs
- Specific code examples and their expected outputs to verify current functionality
Package facts
| License | Apache 2.0 (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — absl-py |
| Maintenance | actively maintained — 2,290 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 132,995/month — #11,532 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: tf_slim-1.1.0-py2.py3-none-any.whl
Keywords: tensorflow, tf-slim, python, machine, learning
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
tf-keras-nightlyTF-Keras is a pure-TensorFlow implementation of…
permissive · top 5,000 on PyPI
thincThinc is a lightweight deep learning library…
permissive · top 1,000 on PyPI
tensorflowTensorFlow is an open-source machine learning…
permissive · top 5,000 on PyPI
tensorflow-addonsTensorFlow Addons provides experimental…
permissive · top 5,000 on PyPI
tensorflow-graphicsTensorFlow Graphics provides differentiable…
permissive · top 15,000 on PyPI
tf-kerasTF-Keras is the pure-TensorFlow implementation…
permissive · top 5,000 on PyPI
tensorflow-recommendersTensorFlow Recommenders provides a Keras-based…
permissive · top 15,000 on PyPI
tf2crfProvides a Conditional Random Field (CRF) layer…
permissive · top 15,000 on PyPI
docker-squashCombines multiple Docker image layers into…
permissive · top 15,000 on PyPI
NeuralFoilNeuralFoil predicts airfoil aerodynamic…
permissive · top 15,000 on PyPI