Hi,
I have defined the weight parameters as follows but still these trainable parameters are not listed in the model.parameters().
class Module(nn.Module):
def __init__(input_dim, output_dim)
#some variables
def build(self):
self.wt_dict = nn.ParameterDict()
# self.wt_dict = {}
for i in range(3):
self.wt_dict["weight_%s"%i] = nn.Parameter(torch.FloatTensor(self.input_dim,self.output_dim))
for j in range(14):
self.wt_dict["weight_left_%s%s"%(i,j)] = nn.Parameter(torch.FloatTensor(self.output_dim,1))
self.wt_dict["weight_right_%s%s"%(i,j)] = nn.Parameter(torch.FloatTensor(self.output_dim,1))
I have tried it using the ParameterDict() and also with the standard dict, but the parameters are not reflected in the model parameters.
Even used the self.register_parameter() to register the parameters but with no success.
Any help would be appreciated.
Thanks!