GoTorch reimplements PyTorch high-level APIs, including modules and functionals, in idiomatic Go. Thus enables deep learning programming in Go and Go+. This project is in its very early stage.
Writing deep learning systems in Go is as efficiently as in Python. The DCGAN training programs in GoTorch and PyTorch call similar APIs, have similar program structure, and have a similar number of lines. Go+ has a syntax similar to Python. The Go+ compiler translates Go+ programs into Go source programs. It is a joy to write Go+ programs that calls Go packages like GoTorch.
We have a plan of a translator that migrates existing PyTorch models in Python into GoTorch.
-
Higher runtime efficiency. Go programs run as efficiently as C++.
-
Training and prediction in the same language. No longer training in Python and online prediction in C++. All in Go/Go+. No TensorFlow graphs or PyTorch tracing.
-
Same data processing code for training and prediction. No need to Wrap OpenCV functions into TensorFlow operators in C++ for prediction and Python for training.
-
Supports many machine learning paradigms., including adversarial, reinforcement, and imitation learning -- those we cannot split into training and prediction.
-
Same program for edge and cloud. GoTorch programs compile and run on phones and self-driving cars as they do on servers and desktops.
GoTorch works with the following open-source communities to form Go+Torch.
- the Go+ community,
- the PyTorch community, and
- the TensorFlow XLA ecosystem.
The following figure reveals the stack of technologies.
Go+ applications # users write DL applications in Go+,
│ # whose syntax is as concise as Python
[Go+ compiler]
↓
Go source code -→ GoTorch -→ libtorch -→ pytorch/xla -→ XLA ops
│
[Go compiler]
↓
executable binary # x86_64, ARM, CUDA, TPU
# Linux, macOS, Android, iOS
- Build and Test
- Design Docs (汉语)
- How To
- Examples
- c++14 need upgrade g++
- gocv used,should install opencv depend on gocv version
- cgotorch depend on libtorch(https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-1.6.0%2Bcpu.zip)
- go invoke cgotorch function use cgo