Hi I am trying to build DCGAN sample from this link: https://github.com/pytorch/examples/tree/master/cpp/dcgan 6.
But I am getting errors like: error: ‘ConvTranspose2dOptions’ is not a member of ‘torch::nn’
Full error message is below:
[ 50%] Building CXX object CMakeFiles/dcgan.dir/dcgan.cpp.o
/home/fugurcal/dcgan/dcgan.cpp:72:6: error: ‘ConvTranspose2d’ in namespace ‘torch::nn’ does not name a type
  nn::ConvTranspose2d conv1, conv2, conv3, conv4;
      ^~~~~~~~~~~~~~~
/home/fugurcal/dcgan/dcgan.cpp:73:6: error: ‘BatchNorm2d’ in namespace ‘torch::nn’ does not name a type
  nn::BatchNorm2d batch_norm1, batch_norm2, batch_norm3;
      ^~~~~~~~~~~
/home/fugurcal/dcgan/dcgan.cpp: In constructor ‘DCGANGeneratorImpl::DCGANGeneratorImpl(int)’:
/home/fugurcal/dcgan/dcgan.cpp:36:9: error: class ‘DCGANGeneratorImpl’ does not have any field named ‘conv1’
       : conv1(nn::ConvTranspose2dOptions(kNoiseSize, 256, 4)
         ^~~~~
/home/fugurcal/dcgan/dcgan.cpp:36:19: error: ‘ConvTranspose2dOptions’ is not a member of ‘torch::nn’
       : conv1(nn::ConvTranspose2dOptions(kNoiseSize, 256, 4)
                   ^~~~~~~~~~~~~~~~~~~~~~
/home/fugurcal/dcgan/dcgan.cpp:36:19: note: suggested alternative: ‘Conv2dOptions’
       : conv1(nn::ConvTranspose2dOptions(kNoiseSize, 256, 4)
                   ^~~~~~~~~~~~~~~~~~~~~~
                   Conv2dOptions
/home/fugurcal/dcgan/dcgan.cpp:38:9: error: class ‘DCGANGeneratorImpl’ does not have any field named ‘batch_norm1’
         batch_norm1(256),
         ^~~~~~~~~~~
/home/fugurcal/dcgan/dcgan.cpp:39:9: error: class ‘DCGANGeneratorImpl’ does not have any field named ‘conv2’
         conv2(nn::ConvTranspose2dOptions(256, 128, 3)
         ^~~~~
/home/fugurcal/dcgan/dcgan.cpp:39:19: error: ‘ConvTranspose2dOptions’ is not a member of ‘torch::nn’
         conv2(nn::ConvTranspose2dOptions(256, 128, 3)
                   ^~~~~~~~~~~~~~~~~~~~~~
/home/fugurcal/dcgan/dcgan.cpp:39:19: note: suggested alternative: ‘Conv2dOptions’
         conv2(nn::ConvTranspose2dOptions(256, 128, 3)
                   ^~~~~~~~~~~~~~~~~~~~~~
                   Conv2dOptions
/home/fugurcal/dcgan/dcgan.cpp:43:9: error: class ‘DCGANGeneratorImpl’ does not have any field named ‘batch_norm2’
         batch_norm2(128),
         ^~~~~~~~~~~
/home/fugurcal/dcgan/dcgan.cpp:44:9: error: class ‘DCGANGeneratorImpl’ does not have any field named ‘conv3’
         conv3(nn::ConvTranspose2dOptions(128, 64, 4)
         ^~~~~
/home/fugurcal/dcgan/dcgan.cpp:44:19: error: ‘ConvTranspose2dOptions’ is not a member of ‘torch::nn’
         conv3(nn::ConvTranspose2dOptions(128, 64, 4)
                   ^~~~~~~~~~~~~~~~~~~~~~
/home/fugurcal/dcgan/dcgan.cpp:44:19: note: suggested alternative: ‘Conv2dOptions’
         conv3(nn::ConvTranspose2dOptions(128, 64, 4)
                   ^~~~~~~~~~~~~~~~~~~~~~
                   Conv2dOptions
/home/fugurcal/dcgan/dcgan.cpp:48:9: error: class ‘DCGANGeneratorImpl’ does not have any field named ‘batch_norm3’
         batch_norm3(64),
         ^~~~~~~~~~~
/home/fugurcal/dcgan/dcgan.cpp:49:9: error: class ‘DCGANGeneratorImpl’ does not have any field named ‘conv4’
         conv4(nn::ConvTranspose2dOptions(64, 1, 4)
         ^~~~~
/home/fugurcal/dcgan/dcgan.cpp:49:19: error: ‘ConvTranspose2dOptions’ is not a member of ‘torch::nn’
         conv4(nn::ConvTranspose2dOptions(64, 1, 4)
                   ^~~~~~~~~~~~~~~~~~~~~~
/home/fugurcal/dcgan/dcgan.cpp:49:19: note: suggested alternative: ‘Conv2dOptions’
         conv4(nn::ConvTranspose2dOptions(64, 1, 4)
                   ^~~~~~~~~~~~~~~~~~~~~~
                   Conv2dOptions
/home/fugurcal/dcgan/dcgan.cpp:55:29: error: ‘conv1’ was not declared in this scope
    register_module("conv1", conv1);
                             ^~~~~
/home/fugurcal/dcgan/dcgan.cpp:55:29: note: suggested alternative: ‘lconv’
    register_module("conv1", conv1);
                             ^~~~~
                             lconv
/home/fugurcal/dcgan/dcgan.cpp:56:29: error: ‘conv2’ was not declared in this scope
    register_module("conv2", conv2);
                             ^~~~~
/home/fugurcal/dcgan/dcgan.cpp:56:29: note: suggested alternative: ‘lconv’
    register_module("conv2", conv2);
                             ^~~~~
                             lconv
/home/fugurcal/dcgan/dcgan.cpp:57:29: error: ‘conv3’ was not declared in this scope
    register_module("conv3", conv3);
                             ^~~~~
/home/fugurcal/dcgan/dcgan.cpp:57:29: note: suggested alternative: ‘lconv’
    register_module("conv3", conv3);
                             ^~~~~
                             lconv
/home/fugurcal/dcgan/dcgan.cpp:58:29: error: ‘conv4’ was not declared in this scope
    register_module("conv4", conv4);
                             ^~~~~
/home/fugurcal/dcgan/dcgan.cpp:58:29: note: suggested alternative: ‘lconv’
    register_module("conv4", conv4);
                             ^~~~~
                             lconv
/home/fugurcal/dcgan/dcgan.cpp:59:35: error: ‘batch_norm1’ was not declared in this scope
    register_module("batch_norm1", batch_norm1);
                                   ^~~~~~~~~~~
/home/fugurcal/dcgan/dcgan.cpp:60:35: error: ‘batch_norm2’ was not declared in this scope
    register_module("batch_norm2", batch_norm2);
                                   ^~~~~~~~~~~
/home/fugurcal/dcgan/dcgan.cpp:61:35: error: ‘batch_norm3’ was not declared in this scope
    register_module("batch_norm3", batch_norm3);
                                   ^~~~~~~~~~~
/home/fugurcal/dcgan/dcgan.cpp: In member function ‘at::Tensor DCGANGeneratorImpl::forward(at::Tensor)’:
/home/fugurcal/dcgan/dcgan.cpp:65:32: error: ‘conv1’ was not declared in this scope
    x = torch::relu(batch_norm1(conv1(x)));
                                ^~~~~
/home/fugurcal/dcgan/dcgan.cpp:65:32: note: suggested alternative: ‘lconv’
    x = torch::relu(batch_norm1(conv1(x)));
                                ^~~~~
                                lconv
/home/fugurcal/dcgan/dcgan.cpp:65:20: error: ‘batch_norm1’ was not declared in this scope
    x = torch::relu(batch_norm1(conv1(x)));
                    ^~~~~~~~~~~
/home/fugurcal/dcgan/dcgan.cpp:66:32: error: ‘conv2’ was not declared in this scope
    x = torch::relu(batch_norm2(conv2(x)));
                                ^~~~~
/home/fugurcal/dcgan/dcgan.cpp:66:32: note: suggested alternative: ‘lconv’
    x = torch::relu(batch_norm2(conv2(x)));
                                ^~~~~
                                lconv
/home/fugurcal/dcgan/dcgan.cpp:66:20: error: ‘batch_norm2’ was not declared in this scope
    x = torch::relu(batch_norm2(conv2(x)));
                    ^~~~~~~~~~~
/home/fugurcal/dcgan/dcgan.cpp:67:32: error: ‘conv3’ was not declared in this scope
    x = torch::relu(batch_norm3(conv3(x)));
                                ^~~~~
/home/fugurcal/dcgan/dcgan.cpp:67:32: note: suggested alternative: ‘lconv’
    x = torch::relu(batch_norm3(conv3(x)));
                                ^~~~~
                                lconv
/home/fugurcal/dcgan/dcgan.cpp:67:20: error: ‘batch_norm3’ was not declared in this scope
    x = torch::relu(batch_norm3(conv3(x)));
                    ^~~~~~~~~~~
/home/fugurcal/dcgan/dcgan.cpp:68:20: error: ‘conv4’ was not declared in this scope
    x = torch::tanh(conv4(x));
                    ^~~~~
/home/fugurcal/dcgan/dcgan.cpp:68:20: note: suggested alternative: ‘lconv’
    x = torch::tanh(conv4(x));
                    ^~~~~
                    lconv
/home/fugurcal/dcgan/dcgan.cpp: In function ‘int main(int, const char**)’:
/home/fugurcal/dcgan/dcgan.cpp:94:60: error: ‘struct torch::nn::ConvOptions<2>’ has no member named ‘bias’
           nn::Conv2dOptions(1, 64, 4).stride(2).padding(1).bias(false)),
                                                            ^~~~
/home/fugurcal/dcgan/dcgan.cpp:95:11: error: ‘LeakyReLU’ is not a member of ‘torch::nn’
       nn::LeakyReLU(nn::LeakyReLUOptions().negative_slope(0.2)),
           ^~~~~~~~~
/home/fugurcal/dcgan/dcgan.cpp:95:25: error: ‘LeakyReLUOptions’ is not a member of ‘torch::nn’
       nn::LeakyReLU(nn::LeakyReLUOptions().negative_slope(0.2)),
                         ^~~~~~~~~~~~~~~~
/home/fugurcal/dcgan/dcgan.cpp:95:25: note: suggested alternative: ‘GRUOptions’
       nn::LeakyReLU(nn::LeakyReLUOptions().negative_slope(0.2)),
                         ^~~~~~~~~~~~~~~~
                         GRUOptions
/home/fugurcal/dcgan/dcgan.cpp:98:62: error: ‘struct torch::nn::ConvOptions<2>’ has no member named ‘bias’
           nn::Conv2dOptions(64, 128, 4).stride(2).padding(1).bias(false)),
                                                              ^~~~
/home/fugurcal/dcgan/dcgan.cpp:99:11: error: ‘BatchNorm2d’ is not a member of ‘torch::nn’
       nn::BatchNorm2d(128),
           ^~~~~~~~~~~
/home/fugurcal/dcgan/dcgan.cpp:99:11: note: suggested alternative: ‘BatchNorm’
       nn::BatchNorm2d(128),
           ^~~~~~~~~~~
           BatchNorm
/home/fugurcal/dcgan/dcgan.cpp:100:11: error: ‘LeakyReLU’ is not a member of ‘torch::nn’
       nn::LeakyReLU(nn::LeakyReLUOptions().negative_slope(0.2)),
           ^~~~~~~~~
/home/fugurcal/dcgan/dcgan.cpp:100:25: error: ‘LeakyReLUOptions’ is not a member of ‘torch::nn’
       nn::LeakyReLU(nn::LeakyReLUOptions().negative_slope(0.2)),
                         ^~~~~~~~~~~~~~~~
/home/fugurcal/dcgan/dcgan.cpp:100:25: note: suggested alternative: ‘GRUOptions’
       nn::LeakyReLU(nn::LeakyReLUOptions().negative_slope(0.2)),
                         ^~~~~~~~~~~~~~~~
                         GRUOptions
/home/fugurcal/dcgan/dcgan.cpp:103:63: error: ‘struct torch::nn::ConvOptions<2>’ has no member named ‘bias’
           nn::Conv2dOptions(128, 256, 4).stride(2).padding(1).bias(false)),
                                                               ^~~~
/home/fugurcal/dcgan/dcgan.cpp:104:11: error: ‘BatchNorm2d’ is not a member of ‘torch::nn’
       nn::BatchNorm2d(256),
           ^~~~~~~~~~~
/home/fugurcal/dcgan/dcgan.cpp:104:11: note: suggested alternative: ‘BatchNorm’
       nn::BatchNorm2d(256),
           ^~~~~~~~~~~
           BatchNorm
/home/fugurcal/dcgan/dcgan.cpp:105:11: error: ‘LeakyReLU’ is not a member of ‘torch::nn’
       nn::LeakyReLU(nn::LeakyReLUOptions().negative_slope(0.2)),
           ^~~~~~~~~
/home/fugurcal/dcgan/dcgan.cpp:105:25: error: ‘LeakyReLUOptions’ is not a member of ‘torch::nn’
       nn::LeakyReLU(nn::LeakyReLUOptions().negative_slope(0.2)),
                         ^~~~~~~~~~~~~~~~
/home/fugurcal/dcgan/dcgan.cpp:105:25: note: suggested alternative: ‘GRUOptions’
       nn::LeakyReLU(nn::LeakyReLUOptions().negative_slope(0.2)),
                         ^~~~~~~~~~~~~~~~
                         GRUOptions
/home/fugurcal/dcgan/dcgan.cpp:108:61: error: ‘struct torch::nn::ConvOptions<2>’ has no member named ‘bias’
           nn::Conv2dOptions(256, 1, 3).stride(1).padding(0).bias(false)),
                                                             ^~~~
/home/fugurcal/dcgan/dcgan.cpp:109:11: error: ‘Sigmoid’ is not a member of ‘torch::nn’
       nn::Sigmoid());
           ^~~~~~~
/home/fugurcal/dcgan/dcgan.cpp:124:64: error: ‘struct torch::optim::AdamOptions’ has no member named ‘betas’; did you mean ‘beta1’?
       generator->parameters(), torch::optim::AdamOptions(2e-4).betas(std::make_tuple (0.5, 0.5)));
                                                                ^~~~~
                                                                beta1
/home/fugurcal/dcgan/dcgan.cpp:126:68: error: ‘struct torch::optim::AdamOptions’ has no member named ‘betas’; did you mean ‘beta1’?
       discriminator->parameters(), torch::optim::AdamOptions(2e-4).betas(std::make_tuple (0.5, 0.5)));
                                                                    ^~~~~
                                                                    beta1
CMakeFiles/dcgan.dir/build.make:62: recipe for target 'CMakeFiles/dcgan.dir/dcgan.cpp.o' failed
make[2]: *** [CMakeFiles/dcgan.dir/dcgan.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/dcgan.dir/all' failed
make[1]: *** [CMakeFiles/dcgan.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2


How can I resolve this issue?