Win10 c++ save torch model error(c2679)

xiaodong_young: <p>i try save model after traing,but i got error after training mnist data,follow example here:<br>
<a href="https://pytorch.org/cppdocs/frontend.html" class="onebox" target="_blank" rel="nofollow noopener">https://pytorch.org/cppdocs/frontend.html</a><br>
here is my error:<br>
D:\yangxiaodong\VSProject\libtorch-win-shared-with-deps-latest\libtorch\include\torch\csrc\api\include\torch/serialize.h(39): error C2679: binary ‘&lt;&lt;’ : no operator found which takes a right-hand operand of type ‘const Value’ (or there is no acceptable conversion)</p>
<p>here is my code:<br>
<span class="hashtag">#include</span> &lt;torch/torch.h&gt;<br>
<span class="hashtag">#include</span> &lt;torch/script.h&gt;<br>
<span class="hashtag">#include</span> <br>
<span class="hashtag">#include</span> <br>
<span class="hashtag">#include</span> <br>
<span class="hashtag">#include</span> &lt;vector<br>
<span class="hashtag">#include</span> &lt;opencv2/core.hpp&gt;<br>
<span class="hashtag">#include</span> &lt;opencv2/highgui.hpp&gt;<br>
<span class="hashtag">#include</span> &lt;opencv2/imgproc.hpp&gt;<br>
<span class="hashtag">#include</span> &lt;opencv2/imgcodecs.hpp&gt;<br>
struct Net : torch::nn::Module {<br>
Net() {<br>
// Construct and register two Linear submodules.<br>
fc1 = register_module(“fc1”, torch::nn::Linear(784, 64));<br>
fc2 = register_module(“fc2”, torch::nn::Linear(64, 32));<br>
fc3 = register_module(“fc3”, torch::nn::Linear(32, 10));<br>
}</p>
<pre><code>// Implement the Net's algorithm.
torch::Tensor forward(torch::Tensor x) {
	// Use one of many tensor manipulation functions.
	x = torch::relu(fc1-&gt;forward(x.reshape({ x.size(0), 784 })));
	x = torch::dropout(x, /*p=*/0.5, /*train=*/is_training());
	x = torch::relu(fc2-&gt;forward(x));
	x = torch::log_softmax(fc3-&gt;forward(x), /*dim=*/1);
	return x;
}

// Use one of many "standard library" modules.
torch::nn::Linear fc1{ nullptr }, fc2{ nullptr }, fc3{ nullptr };
</code></pre>
<p>};</p>
<p>int main() {<br>
// Create a new Net.<br>
auto net = std::make_shared();</p>
<pre><code>// Create a multi-threaded data loader for the MNIST dataset.
auto data_loader = torch::data::make_data_loader(
	torch::data::datasets::MNIST("./data").map(
		torch::data::transforms::Stack&lt;&gt;()),
	/*batch_size=*/64);

// Instantiate an SGD optimization algorithm to update our Net's parameters.
torch::optim::SGD optimizer(net-&gt;parameters(), /*lr=*/0.01);

for (size_t epoch = 1; epoch &lt;= 10; ++epoch) {
	size_t batch_index = 0;
	// Iterate the data loader to yield batches from the dataset.
	for (auto&amp; batch : *data_loader) {
		// Reset gradients.
		optimizer.zero_grad();
		// Execute the model on the input data.
		torch::Tensor prediction = net-&gt;forward(batch.data);
		// Compute a loss value to judge the prediction of our model.
		torch::Tensor loss = torch::nll_loss(prediction, batch.target);
		// Compute gradients of the loss w.r.t. the parameters of our model.
		loss.backward();
		// Update the parameters based on the calculated gradients.
		optimizer.step();
		// Output the loss and checkpoint every 100 batches.
		if (++batch_index % 100 == 0) {
			std::cout &lt;&lt; "Epoch: " &lt;&lt; epoch &lt;&lt; " | Batch: " &lt;&lt; batch_index
				&lt;&lt; " | Loss: " &lt;&lt; loss.item&lt;float&gt;() &lt;&lt; std::endl;
			// Serialize your model periodically as a checkpoint.
                            //here i got an error
			torch::save(net, "d:/net.pt");
		}
	}
}
</code></pre>
<p>}</p>

Yuichiro_Shishido: <p>please try</p>
<p>struct Net : torch::nn::Module<br>
↓<br>
struct Net : public torch::nn::Module</p>