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.21k stars 9.51k forks source link

C++ dcgan 'transposed' error #696

Open maziar840 opened 4 years ago

maziar840 commented 4 years ago

Hi

I had the issue with 'with_bias' which was resolved using #669. Now it seems there is an issue with 'transposed':

.../pytorch/examples/cpp/dcgan/dcgan.cpp:48:23: error: ‘struct torch::nn::ConvOptions<2>’ has no member named ‘transposed’ 48 | .transposed(true)), | ^~~~~~~~~~

krshrimali commented 4 years ago

The C++ Frontend went through many changes in the past few months. PR (https://github.com/pytorch/pytorch/pull/31005) made Conv{1,2,3}dOptions and ConvTranspose{1,2,3}dOptions different classes. For users who see this issue, consider updating your GitHub repo with the latest changes (if you haven't already), and also with the latest Libtorch version.

The updated examples have working version of this. For non-sequential models, all you need to change is: use torch::nn::ConvTranspose2dOptions without .transposed(true) argument. And it should work! If you are using a sequential model, check the tutorials on C++ Frontend OR check the description in the PR (https://github.com/pytorch/pytorch/pull/31005).