Running error with libtorch C++ front

Hi, guys
I have some error while running the the DCGAN sample from the official tutorial.

  1. I have downloaded the MNIST and saved them in the folder “C:\Users\Administrator\Desktop\MINIST_data”
  2. There is no error while i generate solutions
  3. while i run the project , it shows error in the "torch::data::datasets::MNIST(“C:/Users/Administrator/Desktop/MINIST_data”)".map(torch::data::transforms::Normalize<>(0.5, 0.5)).map(torch::data::transforms::Stack<>());
  4. The error is “There is an unhandled exception at 0x00007ffcfcd03fb8 (in dcgan. Exe): Microsoft C + + exception: C10:: error, at memory location 0x000000182cf2e360.

Is there something wrong with my path? How should i setup the path?

The following is the code:

auto dataset = torch::data::datasets::MNIST(“C:/Users/Administrator/Desktop/MINIST_data”)
.map(torch::data::transforms::Normalize<>(0.5, 0.5))
const int64_t batches_per_epoch =
std::ceil(dataset.size().value() / static_cast(kBatchSize));

auto data_loader = torch::data::make_data_loader(

torch::optim::Adam generator_optimizer(
generator->parameters(), torch::optim::AdamOptions(2e-4).beta1(0.5));
torch::optim::Adam discriminator_optimizer(
discriminator->parameters(), torch::optim::AdamOptions(2e-4).beta1(0.5));

I think, work path or It seems to be a problem with the data file path or dll path

Yes, i have solved the problem. It is really the problem with the file path.

I have the same problem but dont know how to solve it could you be more speceific?

I changed like this:

std::string mnistpath = “C:\Users\Administrator\Desktop\MINIST_data\MNIST\raw”;
torch::data::datasets::MNIST cMnist = torch::data::datasets::MNIST(mnistpath);
auto data_loader = torch::data::make_data_loader(<>()));

hello my friend, I try just as what you say but it still don’t work, here is the MNIST dataset content of my path and I want to know is it the same as your path? if not, what is the content in your path “C:/Users/Administrator/Desktop/MINIST_data”?

I see that your path is “C:\Users\Administrator\Desktop\MINIST_data\MNIST\raw”, and I am wondering what the file in the “raw” folder?I seems really important to solve my problem.