THE C++ FRONTEND Example Can not run correctly

DaDa: <p>Hi, I have spend 2 days trying to figure out why but still can’t, it would be really appreciate if you can help.</p>
<p>Windows 10<br>
VS Code<br>
VS Studio</p>
<p>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.<br>
<a href="https://pytorch.org/cppdocs/frontend.html" rel="noopener nofollow ugc">The C++ Frontend — PyTorch master documentation</a></p>
<p>In Windows terminal, there are no error in <code>cmake</code> and no error during <code>make</code>. However, after I excute <code>./main</code>, and waiting for some time, it stopped without hints.<br>
I added some <code>std::cout &lt;&lt; "Flag 1" &lt;&lt; std::endl</code> in the example code, and I found the program can not complete this step.</p>
<pre><code class="lang-auto">// 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&lt;&gt;()),

      /*batch_size=*/64);
</code></pre>
<p>Which may suggested that the <code>MNIST</code> can not read the <code>MNIST datasets</code>. (I have tried uncompressed dataset or compressed dataset. I write a Python program to read the same dataset and it goes well.)</p>
<p>Then, in order to figure the error out, I changed into VS Studio, and it give an error as following screenshot.<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/4/f/4f4cb8fb8a08f0fdfc01fdff61a9859fd1a2e3c2.png" data-download-href="https://discuss.pytorch.org/uploads/default/4f4cb8fb8a08f0fdfc01fdff61a9859fd1a2e3c2" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/4/f/4f4cb8fb8a08f0fdfc01fdff61a9859fd1a2e3c2_2_690x250.png" alt="image" data-base62-sha1="bjw62ZvnkSHbN1pKeqIRT4iPF3s" width="690" height="250" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/4/f/4f4cb8fb8a08f0fdfc01fdff61a9859fd1a2e3c2_2_690x250.png, https://discuss.pytorch.org/uploads/default/optimized/3X/4/f/4f4cb8fb8a08f0fdfc01fdff61a9859fd1a2e3c2_2_1035x375.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/4/f/4f4cb8fb8a08f0fdfc01fdff61a9859fd1a2e3c2_2_1380x500.png 2x" data-dominant-color="272929"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">2277×828 200 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
<p>Then, I also trying to use the new example code here<br>
<a href="https://github.com/TonyzBi/libtorch-mnist/blob/master/mnist.cpp" rel="noopener nofollow ugc">libtorch-mnist/mnist.cpp at master · TonyzBi/libtorch-mnist · GitHub</a></p>
<p>But it has two errors,</p>
<pre><code class="lang-auto">register_module("conv2_drop", conv2_drop);
torch::nn::FeatureDropout conv2_drop;
</code></pre>
<p>Said the <code>FeatureDropout</code> is not in <code>torch::nn</code> anymore.</p>
<p>I have searched the current libtorch API, and found</p>
<pre><code class="lang-auto">torch::nn::functional::dropout
</code></pre>
<p>But the function <code>torch::nn::functional::dropout is not a type nameC/C++(757)</code><br>
so it is different with the new example code usage.</p>
<p>Really hope someone can help me on this.</p>