1. PyTorch C++ Frontend Tutorial

    In this blog post, I will demonstrate how to define a model and train it in the PyTorch C++ API front end. Since not everyone has access to a DGX-2 to train their Progressive GAN in one week. I looked for ways to speed up the training of the model. Naturally changing to a lower level language should provide some speed ups. Unfortunately (or fortunately), deep learning models are compute bound so overhead from acquiring the Python GIL is negligible. My timings show only around a 3% speed up. I’m sure more speed up may be obtained if high levels of preprocessing/IO operations are required or highly optimized C++ code. TLDR; just show me the code repo. …


  2. Training a TensorFlow graph in C++ API

    First off, I want to explain my motivation for training the model in C++ and why you may want to do this. TensorFlow is written in C/C++ wrapped with SWIG to obtain python bindings providing speed and usability. However, when a call from python is made to C/C++ e.g. TensorFlow or numpy. Python’s global interpreter lock (GIL) must be acquired to perform each call. A few context switches are fine but repeated calls can gradually add up such as performing a true stochastic gradient descent. Moreover, integrating other models with deep learning that do not run effectively on GPUs can require a lot of costly memory transfers. To avoid this I decided to run it directly in C++ providing better performance and finer grain control of GPU memory allocations. …