Model structure problem

Hi,
I have to compare and change values of two models,

model 1 names block_model and the other is new_model.

I made this models with other methods, so

model 2 has structure like
image ,

and model 1 has same structure like
MSRN(
(sub_mean): MeanShift(3, 3, kernel_size=(1, 1), stride=(1, 1))
(add_mean): MeanShift(3, 3, kernel_size=(1, 1), stride=(1, 1))
(head): Sequential(
(0): DSConv2d(3, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
)
(body): Sequential(
(0): MSRB(
(conv_3_1): DSConv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(conv_3_2): DSConv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(conv_5_1): DSConv2d(64, 64, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), bias=False)
(conv_5_2): DSConv2d(128, 128, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), bias=False)
(confusion): DSConv2d(256, 64, kernel_size=(1, 1), stride=(1, 1), bias=False)
(relu): ReLU(inplace=True)
)
(1): MSRB(
(conv_3_1): DSConv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(conv_3_2): DSConv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(conv_5_1): DSConv2d(64, 64, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), bias=False)
(conv_5_2): DSConv2d(128, 128, kernel_size=(5, 5), stride=(1, 1), padding=(2, 2), bias=False)
(confusion): DSConv2d(256, 64, kernel_size=(1, 1), stride=(1, 1), bias=False)
(relu): ReLU(inplace=True)
)
โ€ฆ

as you can see, model 2 has โ€œModel( (model) : ~)โ€ at first.

I want to compare and change values of each convolution.
anyone know how to access to the same layer of both model?

now iโ€™m using zip(block_model, newmodel), but itโ€™s sequence is different because of โ€œModel( (model) : ~)โ€, but I donโ€™t know how to get the same layer of both model at one time.

Please help me !

Thanks.

By looking at architecture posted in the screenshot. You can simply do zip(block_model, newmodel.model) to compare layers.

1 Like

thanks for reply !

it worksโ€ฆ thankyou !!!