About the conversion of torch::optim::Adam from python to libtorch

Hi, All

I have an inquiry about converting the following from python to libtorch

python code is:
self.Goptim = optim.Adam(self.G.parameters(), lr=args.lr, betas = (args.momentum,0.999))

In libtorch it has an error if I write

torch::optim::Adam doptim(
discriminator->parameters(),torch::optim::AdamOptions(args.lr_default).beta1(args.momentum).beta2(0.999) );

“No member named “beta1” in torch::optim::Adamoptions”

Any suggestion to correct it please ?


beta1 and beta2 are undefined and you should use betas instead as seen here.

Thank you very much.

It works.