Hi, I have spend 2 days trying to figure out why but still can’t, it would be really appreciate if you can help.
Windows 10
VS Code
VS Studio
I have installed every necessary parts and set correctly, and I can successfully run libtorch + OpenCV examples, and other examples, but even I copied the example code on this page, it can not run correctly.
The C++ Frontend — PyTorch master documentation 1
In Windows terminal, there are no error in cmake and no error during make. However, after I excute ./main, and waiting for some time, it stopped without hints.
I added some std::cout << "Flag 1" << std::endl in the example code, and I found the program can not complete this step.
// Create a multi-threaded data loader for the MNIST dataset.

  auto data_loader = torch::data::make_data_loader(

      torch::data::datasets::MNIST("C:/Users/J Chen/Program/c-cpp/torchtest1/MNIST_Data/").map(

          torch::data::transforms::Stack<>()),

      /*batch_size=*/64);

Which may suggested that the MNIST can not read the MNIST datasets. (I have tried uncompressed dataset or compressed dataset. I write a Python program to read the same dataset and it goes well.)
Then, in order to figure the error out, I changed into VS Studio, and it give an error as following screenshot.

image2277×828 200 KB

Then, I also trying to use the new example code here
libtorch-mnist/mnist.cpp at master · TonyzBi/libtorch-mnist · GitHub
But it has two errors,
register_module("conv2_drop", conv2_drop);
torch::nn::FeatureDropout conv2_drop;

Said the FeatureDropout is not in torch::nn anymore.
I have searched the current libtorch API, and found
torch::nn::functional::dropout

But the function torch::nn::functional::dropout is not a type nameC/C++(757)
so it is different with the new example code usage.
Really hope someone can help me on this.