In Python version I do something like this:
train_data = torch.utils.data.TensorDataset(X_train, y_train)
train_loader = torch.utils.data.DataLoader(train_data, batch_size=batch_size, shuffle=True)

X_train and y_train are (samples, features) and (samples, target) Tensors, respectively.
When I comes to C++, I can not find the same way to define my own dataset. I already read the official tutorial(https://pytorch.org/tutorials/advanced/cpp_frontend.html 5), but there is little information about how to define our own (X, y) training dataset because it uses the MNIST dataset that comes with the C++ frontend.
I did find the TensorDataset C++ API, but how can I use it? I tried to use it like the Python way, but it did not work:
torch::Tensor X_train = torch::eye(3);
torch::Tensor y_train = torch::randn({3, 2});
auto train_data = torch::data::datasets::TensorDataset(X_train);
auto data_loader = torch::data::make_data_loader(std::move(train_data));