How can I push a module into a sequential?

Is there any example about pushing a module into a sequential? I have been stuck here two days.
“”"
torch::nn::Sequential layer1{ nullptr };
auto conv1 = torch::nn::Conv2d(torch::nn::Conv2dOptions(64, 64, 1).stride(1).bias(false));
layer1->push_back(conv1);
“”"
Then I got error: Accessing empty ModuleHolder
I have tried push_back(&conv1),push_back(std::move(conv1)), none of them worked and I cannot find any example on internet, is anyone can help?

I have solved it, layer1 was initiated with null in my code.

For future reference,
https://pytorch.org/docs/stable/generated/torch.nn.Sequential.html

Example of using Sequential

model = nn.Sequential(
nn.Conv2d(1,20,5),
nn.ReLU(),
nn.Conv2d(20,64,5),
nn.ReLU()
)

Example of using Sequential with OrderedDict

model = nn.Sequential(OrderedDict([
(‘conv1’, nn.Conv2d(1,20,5)),
(‘relu1’, nn.ReLU()),
(‘conv2’, nn.Conv2d(20,64,5)),
(‘relu2’, nn.ReLU())
]))