Home

Awesome

<a href="https://tensorlayerx.readthedocs.io/"> <div align="center"> <img src="https://git.openi.org.cn/hanjr/tensorlayerx-image/raw/branch/master/tlx-LOGO--02.jpg" width="50%" height="30%"/> </div> </a> <!--- [![PyPI Version](https://badge.fury.io/py/tensorlayer.svg)](https://pypi.org/project/tensorlayerx/) ---> <!--- ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/tensorlayer.svg)) --->

GitHub last commit (branch) Documentation Status Build Status Downloads Downloads Docker Pulls

TensorLayerX is a multi-backend AI framework, supports TensorFlow, Pytorch, MindSpore, PaddlePaddle, OneFlow and Jittor as the backends, allowing users to run the code on different hardware like Nvidia-GPU, Huawei-Ascend, Cambricon and more. This project is maintained by researchers from Peking University, Peng Cheng Lab, HKUST, Imperial College London, Princeton, Oxford, Stanford, Tsinghua and Edinburgh.

<!-- # Document TensorLayerX has extensive documentation for both beginners and professionals. [![English Documentation](https://img.shields.io/badge/documentation-english-blue.svg)](https://tensorlayerx.readthedocs.io/en/latest/) -->

Deep Learning course

We have video courses for deep learning, with example codes based on TensorLayerX.
Bilibili link (chinese)

Design Features

<!-- <p align="center"><img src="https://git.openi.org.cn/hanjr/tensorlayerx-image/raw/branch/master/version.png" width="840"\></p> -->

Multi-backend Design

You can immediately use TensorLayerX to define a model via Pytorch-stype, and switch to any backends easily.

import os
os.environ['TL_BACKEND'] = 'tensorflow' # modify this line, switch to any backends easily!
#os.environ['TL_BACKEND'] = 'mindspore'
#os.environ['TL_BACKEND'] = 'paddle'
#os.environ['TL_BACKEND'] = 'torch'
import tensorlayerx as tlx
from tensorlayerx.nn import Module
from tensorlayerx.nn import Linear
class CustomModel(Module):

  def __init__(self):
      super(CustomModel, self).__init__()

      self.linear1 = Linear(out_features=800, act=tlx.ReLU, in_features=784)
      self.linear2 = Linear(out_features=800, act=tlx.ReLU, in_features=800)
      self.linear3 = Linear(out_features=10, act=None, in_features=800)

  def forward(self, x, foo=False):
      z = self.linear1(x)
      z = self.linear2(z)
      out = self.linear3(z)
      if foo:
          out = tlx.softmax(out)
      return out

MLP = CustomModel()
MLP.set_eval()

Quick Start

Get started with TensorLayerX quickly using the following examples:

Resources

More official resources can be found here

Installation

TensorLayerXTensorFlowMindSporePaddlePaddlePyTorchOneFlowJittor
v0.5.8v2.4.0v1.8.1v2.2.0v1.10.0--v1.3.8.5
v0.5.7v2.0.0v1.6.1v2.0.2v1.10.0----
# install from pypi
pip3 install tensorlayerx 
# install from Github
pip3 install git+https://github.com/tensorlayer/tensorlayerx.git 

For more installation instructions, please refer to Installtion

Docker is an open source application container engine. In the TensorLayerX Docker Repository, different versions of TensorLayerX have been installed in docker images.

# pull from docker hub
docker pull tensorlayer/tensorlayerx:tagname

Contributing

Join our community as a code contributor, find out more in our Help wanted list and Contributing guide!

Getting Involved

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

<br/> <a href="https://join.slack.com/t/tensorlayer/shared_invite/enQtODk1NTQ5NTY1OTM5LTQyMGZhN2UzZDBhM2I3YjYzZDBkNGExYzcyZDNmOGQzNmYzNjc3ZjE3MzhiMjlkMmNiMmM3Nzc4ZDY2YmNkMTY" target="\_blank"> <div align="center"> <img src="https://github.com/tensorlayer/TensorLayer/blob/bdc2c14ff9ed9bd3ec7004d625e15683df7b530d/img/join_slack.png?raw=true" width="40%"/> </div> </a>

Contact

Citation

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

@inproceedings{tensorlayer2021,
  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)},
  pages={1--3},
  year={2021},
  organization={IEEE}
}
@article{tensorlayer2017,
    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     = {http://tensorlayer.org},
    year    = {2017}
}