Hi,
I would like to initialize weights and bias with arbitrary values, not with uniforms or constant number.
class Model(nn.Module):
def init(self,init_param):
super(Model, self).init()
self.conv1 = nn.Conv2d(512, 512, 3)
self.conv1.weight = initial_param[‘weight’]
self.conv1.bias = initial_param[‘bias’]
def forward(self, x):
   return F.relu(self.conv2(x))

model = Model(initial_param)
initial_param[‘weight’] and initial_param['bias] are torch.FloatTensor of size 512x512x3x3 and 512 respectively.
I got following error
TypeError: cannot assign ‘torch.FloatTensor’ as child module ‘conv1’ (torch.nn.Module or None expected)
How to assign arbitrary values to parameters?
Now, my purpose is convert torch(lua) model to pytorch model.( torch.legacy.nn.Sequential to pytorch model)
I’m trying to extract weight and bias from legacy model and assign to pytorch model since there is no way to do it automatically.
Thanks.