I am trying to implement a local linear regression problem for each output. I have written this piece of code. But this code is not working.
Please help me how can I fix this.
def __init__(self):
super(Net, self).__init__()
input_dim = 9
self.layers = nn.ModuleList()
for ii in range(image_size):
self.layers.append(nn.Linear(input_dim, 1))
def forward(self, xt, c):
d = xt.shape[0]
xt = xt.view(xt.size(0), -1)
out = Variable(torch.zeros(d, image_size), requires_grad=False)
ii = 0
for layer in self.layers[:-1]:
xx = xt[:,indices[ii]]
le_xx = xx.shape[1]
if le_xx < 9:
xtt = torch.zeros(d, 9)
xtt[:, :le_xx] = xx
else:
xtt = xx
txt = layer(xtt)
out[:, ii] = txt.squeeze()
ii = ii+1
xt = out
xt = xt.view(d,3,64,64)
return xt