How to build a dataset using PyTorch C++ frontend

I’ve been trying to deploy my model in the form of a desktop application and I’ve successfully loaded my trained model in the C++ frontend. But I don’t know how to build my own dataset using C++ API. The tutorial only demonstrates how to load MNIST dataset. Dose anyone know how to do this?

Thanks in advance.

Creating a C++ dataset is similar to creating a PyTorch python dataset.

One has to subclass the Dataset class, and then implement some base methods.

See the MNIST class for example:


Alternatively, you can subclass from BatchDataset and implement a get_batch method that returns a batch of samples directly: https://github.com/pytorch/pytorch/blob/master/torch/csrc/api/include/torch/data/datasets/base.h#L40-L94

I’ll look into that. Thanks a lot! :innocent: