Hi, All
I have an inquiry on converting from pytorch to C++ in looping over dataset. The python code is;
unlabel_loader1 = DataLoader(self.unlabeled, batch_size = self.args.batch_size, shuffle=True, drop_last=True, num_workers = 4)
for (unlabel1, _label1) in unlabel_loader1:
batch_num += 1
I convert to C++ with libtorch as:
auto unlabel1 = torch::data::datasets::MNIST("/path/MNISTv2",
torch::data::datasets::MNIST::Mode::kTrain).map(
torch::data::transforms::Normalize<>(0.13707, 0.3081)).map(torch::data::transforms::Stack<>());
auto unlabel_loader1 = torch::data::make_data_loadertorch::data::samplers::SequentialSampler(unlabel1, torch::data::DataLoaderOptions().batch_size(args.batch_size).workers(4).drop_last(
true));
But I am not sure how shall I translate " for (unlabel1, _label1) in unlabel_loader1:" into C++.
Any comments are appreciated.
Thanks in advance.