State_dict does not contain keys for conv layers in list
<SCODE>import torch.nn as nn
class Classifier_Module(nn.Module):

    def __init__(self,dilation_series,padding_series):
        super(Classifier_Module, self).__init__()
	    self.conv2d_list = []
	    for dilation,padding in zip(dilation_series,padding_series):
	        self.conv2d_list.append(nn.Conv2d(2048,5,kernel_size=3,stride=1, padding =padding, dilation = dilation,bias = True))

   
    def forward(self, x):
	    out = self.conv2d_list[0](x)
	    for i in range(len(self.conv2d_list)-1):
	        out = self.conv2d_list[i+1](x)+out
        return out


class Module1(nn.Module):
    def __init__(self):
        super(Module1, self).__init__()
        self.layer = self._make_pred_layer(Classifier_Module, [6,12,18,24],[6,12,18,24])

    def _make_pred_layer(self,block, dilation_series, padding_series):
    	return nn.Sequential(block(dilation_series,padding_series))

    def forward(self, x):
        x = self.layer(x)
        return x
<ECODE> The state dictionary of the net does not contain any keys corresponding to the conv2d layers of the Classifier_Module. <SCODE>import sample
model = getattr(sample,'Module1')()
print model   # 1 does not show conv2d list
for keys in model.state_dict().keys():
    print keys    #2 does not show con2d list
print model.layer._modules['0'].conv2d_list  # this shows the conv2d list

<ECODE> How can I fix this issue? Is there any other way to perform a similar function without writing code for each conv2d layer?
isht7
jekbradbury
isht7
Yes, you can return multiple outputs form a module
apaszke