pytorch / examples

A set of examples around pytorch in Vision, Text, Reinforcement Learning, etc.
https://pytorch.org/examples
BSD 3-Clause "New" or "Revised" License
22.01k stars 9.49k forks source link

cpp/dcgan error in windows 10 with pytorch 1.0 #553

Open maxiaoyuelun opened 5 years ago

maxiaoyuelun commented 5 years ago

my os: windows 10 libtorch 1.0 visual studio 2015

I run cpp/mnist and got the right answer, but when I run cpp/dcgan, I got the error in file :

D:\BUILD\libtorch\include\torch/csrc/utils/variadic.h(195): error C2059: syntax error: 'template' D:\BUILD\libtorch\include\torch/csrc/utils/variadic.h(190): note: see reference to function template instantiation 'ReturnType torch::unpack<ReturnType,at::Tensor,torch::nn::AnyModule::Holder<torch::nn::Conv2dImpl,at::Tensor>::InvokeForward,torch::nn::AnyModule::Holder<torch::nn::Conv2dImpl,at::Tensor>::CheckedGetter,0>(Function,Accessor,torch::Indices<0>)' being compiled with [ ReturnType=torch::nn::AnyModule::Value, Function=torch::nn::AnyModule::Holder<torch::nn::Conv2dImpl,at::Tensor>::InvokeForward, Accessor=torch::nn::AnyModule::Holder<torch::nn::Conv2dImpl,at::Tensor>::CheckedGetter ]

I just check for one night, can anyone catch the same problem?

maxiaoyuelun commented 5 years ago

I think nn::Sequential cause the problem, when i use nn::Module to rewrite the code, the code with nn::Module got the right answer, but the code with nn::Sequential just got compile error. I don't know how to solve the problem!!!

I tested on the very latest libtorch and find that the nn::Sequential can't work in windows with viusal studio, anyone catch the problem?

KuanL1u commented 5 years ago

I think nn::Sequential cause the problem, when i use nn::Module to rewrite the code, the code with nn::Module got the right answer, but the code with nn::Sequential just got compile error. I don't know how to solve the problem!!!

I tested on the very latest libtorch and find that the nn::Sequential can't work in windows with viusal studio, anyone catch the problem?

I tried to compile it with Cmake first. Then I can use Visual Studio to run the dcgan example.

Actually I also have some questions about these examples. Could you give me your contact like wechat so I can talk with you directly? Thanks :)