Mapping from pytorch to libtorch for batchnorm1d

Hi, All

I recently try to map the following line from pytorch to libtorch

self.bn1 = nn.BatchNorm1d(500, affine = False, eps=1e-6, momentum = 0.5)

and I write in libtroch

bn1 = torch::nn::BatchNorm1d(500, false, 1e-6, 0.5);

It gives me an error no viable overloaded “=”

Any suggestions on fix the error please ?


It is also incorrect if I use
bn1 = register_module(“bn1”, torch::nn::BatchNorm1d(500, false, 1e-6, 0.5));

torch::nn::Sequential bn1;
bn1->push_back(torch::nn::BatchNorm1d(500, false, 1e-6, 0.5));

The above has no error, is the above expression correct ?