You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.
Eric_lai cdf12388ad test 2 days ago
.circleci Update config.yml 1 year ago
.github PyUP - Dependency Update Scheduled daily dependency update on wednesday (#647) 3 years ago
docker yapf 1 year ago
docs Update docs 2 weeks ago
examples Fix docs 3 weeks ago
img Update 4 months ago
requirements update tensorlayer3 5 months ago
scripts Transparent distributed model training through TensorLayer GPU Trainer (#700) 3 years ago
tensorlayer Add save standard weights 2 days ago
tests Update initilizers 3 months ago
.codacy.yaml Update .codacy.yaml 1 year ago
.dockerignore fix Dokerfile: use tensorflow cpu base image by default 4 years ago
.gitignore move data 2 years ago
.pyup.yml Contrib Loggers Module Added - Hyperdash (#739) 3 years ago
.readthedocs.yml Documentation/mock imports (#785) 3 years ago
.travis.yml 更新 '.travis.yml' 2 days ago Merge branch 'master' into Release 1 year ago update for rst usage 2 years ago
LICENSE.rst Update LICENSE.rst 1 year ago
Makefile Fix build test. (#1057) 1 year ago 更新 '' 3 months ago
README.rst Update README.rst 3 months ago
setup.cfg Update setup.cfg 1 year ago fix yapf errors 2 years ago
setup.travis.cfg Update setup.travis.cfg 2 years ago
setup.travis_doc.cfg Tl logging layer name fix (#683) 3 years ago Update 1 week ago
test test 2 days ago
tl Introduce an experimental CLI to help train TL programs using multiple GPUs. (#287) 3 years ago

GitHub last commit (branch)
Supported TF Version
Documentation Status
Build Status
Docker Pulls
Codacy Badge


TensorLayer is a deep learning library designed for researchers and engineers that is compatible with multiple deep learning frameworks. It provides an extensive collection of customizable neural layers to build advanced AI models quickly, based on this, the community open-sourced mass tutorials and applications. TensorLayer is awarded the 2017 Best Open Source Software by the ACM Multimedia Society.
This project can also be found at iHub and Gitee.


🔥 3.0.0 has been pre-released, it supports TensorFlow and MindSpore backends, and supports some PaddlePaddle operator backends, allowing users to run the code on different hardware like Nvidia-GPU and Huawei-Ascend. It will support TensorFlow, MindSpore, PaddlePaddle, and PyTorch backends in the future. Feel free to use it and make suggestions. We need more people to join the dev team, if you are interested, please email

🔥 Reinforcement Learning Zoo: Low-level APIs for professional usage, High-level APIs for simple usage, and a corresponding Springer textbook

🔥 Sipeed Maxi-EMC: Run TensorLayer models on the low-cost AI chip (e.g., K210) (Alpha Version)

Design Features

TensorLayer is a new deep learning library designed with simplicity, flexibility and high-performance in mind.

  • Simplicity : TensorLayer has a high-level layer/model abstraction which is effortless to learn. You can learn how deep learning can benefit your AI tasks in minutes through the massive examples.
  • Flexibility : TensorLayer APIs are transparent and flexible, inspired by the emerging PyTorch library. Compared to the Keras abstraction, TensorLayer makes it much easier to build and train complex AI models.
  • Zero-cost Abstraction : Though simple to use, TensorLayer does not require you to make any compromise in the performance of TensorFlow (Check the following benchmark section for more details).

TensorLayer stands at a unique spot in the TensorFlow wrappers. Other wrappers like Keras and TFLearn hide many powerful features of TensorFlow and provide little support for writing custom AI models. Inspired by PyTorch, TensorLayer APIs are simple, flexible and Pythonic, making it easy to learn while being flexible enough to cope with complex AI tasks.TensorLayer has a fast-growing community. It has been used by researchers and engineers all over the world, including those from Peking University,Imperial College London, UC Berkeley, Carnegie Mellon University Stanford University, and companies like Google, Microsoft, Alibaba, Tencent, Xiaomi, and Bloomberg.

Multilingual Documents

TensorLayer has extensive documentation for both beginners and professionals. The documentation is available in
both English and Chinese.

English Documentation
Chinese Documentation
Chinese Book

If you want to try the experimental features on the the master branch, you can find the latest document

Extensive Examples

You can find a large collection of examples that use TensorLayer in here and the following space:

Getting Start

Comparison of TensorLayer version

TensorLayer 3.0 relies on TensorFlow, numpy, and others. To use GPUs, CUDA and cuDNN are required.

Install TensorFlow:

pip3 install tensorflow-gpu==2.0.0-rc1 # TensorFlow GPU (version 2.0 RC1)
pip3 install tensorflow # CPU version

Install the stable release of TensorLayer3:

pip3 install tensorlayer3

Install the stable release of TensorLayer2.x:

pip3 install tensorlayer

Install the unstable development version of TensorLayer3:

pip3 install git+

If you want to install the additional dependencies, you can also run

pip3 install --upgrade tensorlayer[all]              # all additional dependencies
pip3 install --upgrade tensorlayer[extra]            # only the `extra` dependencies
pip3 install --upgrade tensorlayer[contrib_loggers]  # only the `contrib_loggers` dependencies

If you want to use mindspore backend, you should install mindspore>=1.2.1

pip install --trusted-host -i

If you want to use paddlepaddle backend, you should install paddlepaddle>=2.1.1

python -m pip install paddlepaddle -i

If you are TensorFlow 1.X users, you can use TensorLayer 1.11.0:

# For last stable version of TensorLayer 1.X
pip3 install --upgrade tensorlayer==1.11.0

Performance Benchmark

The following table shows the training speeds of VGG16 using TensorLayer and native TensorFlow on a TITAN Xp.

Mode Lib Data Format Max GPU Memory Usage(MB) Max CPU Memory Usage(MB) Avg CPU Memory Usage(MB) Runtime (sec)
AutoGraph TensorFlow 2.0 channel last 11833 2161 2136 74
TensorLayer 2.0 channel last 11833 2187 2169 76
Graph Keras channel last 8677 2580 2576 101
Eager TensorFlow 2.0 channel last 8723 2052 2024 97
TensorLayer 2.0 channel last 8723 2010 2007 95
TensorLayer 3.0 channel last

Getting Involved

Please read the Contributor Guideline before submitting your PRs.

We suggest users to report bugs using Github issues. Users can also discuss how to use TensorLayer in the following slack channel.

Citing TensorLayer

If you find TensorLayer useful for your project, please cite the following papers:

    author  = {Dong, Hao and Supratak, Akara and Mai, Luo and Liu, Fangde and Oehmichen, Axel and Yu, Simiao and Guo, Yike},
    journal = {ACM Multimedia},
    title   = {{TensorLayer: A Versatile Library for Efficient Deep Learning Development}},
    url     = {},
    year    = {2017}

  title={Tensorlayer 3.0: A Deep Learning Library Compatible With Multiple Backends},
  author={Lai, Cheng and Han, Jiarong and Dong, Hao},
  booktitle={2021 IEEE International Conference on Multimedia \& Expo Workshops (ICMEW)},