Announcing a series of blogs on PyTorch C++ API

I’m happy to announce a Series of Blog Posts on PyTorch C++ API. Check out the blogs in the series here. Happy Reading!

July 4, 2019 · 1 min · Kushashwa Ravi Shrimali

Custom Data Loading using PyTorch C++ API

Overview: How C++ API loads data? In the last blog, we discussed application of a VGG-16 Network on MNIST Data. For those, who are reading this blog for the first time, here is how we had loaded MNIST data: auto data_loader = torch::data::make_data_loader<torch::data::samplers::SequentialSampler>( std::move(torch::data::datasets::MNIST("../../data").map(torch::data::transforms::Normalize<>(0.13707, 0.3081))).map( torch::data::transforms::Stack<>()), 64); Let’s break this piece by piece, as for beginners, this may be unclear. First, we ask the C++ API to load data (images and labels) into tensors. ...

July 2, 2019 · 8 min · Kushashwa Ravi Shrimali

Introduction to PyTorch C++ API: MNIST Digit Recognition using VGG-16 Network

Environment Setup [Ubuntu 16.04, 18.04] Note: If you have already finished installing PyTorch C++ API, please skip this section. Download libtorch: CPU Version: wget https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-latest.zip -O libtorch.zip GPU Version (CUDA 9.0): wget https://download.pytorch.org/libtorch/cu90/libtorch-shared-with-deps-latest.zip -O libtorch.zip GPU Version (CUDA 10.0): wget https://download.pytorch.org/libtorch/cu100/libtorch-shared-with-deps-latest.zip Unzip libtorch.zip: unzip libtorch.zip We’ll use the absolute path of extracted directory (libtorch) later on. Implementation The VGG-16 Network is shown in the Figure below. We’ll start of by first including libtorch header file. ...

June 7, 2019 · 3 min · Kushashwa Ravi Shrimali