Hello, I used the ready-made loss function from torch.nn, but error “one of the variables needed for gradient computation has been modified by an inplace operation: [torch.FloatTensor [4096, 1]]” everything is also there, maybe there is a problem in forward method? The model has 2 inputs and two outputs, I do not know what to do.
def forward(self, Ximg, Xroi):
cnn_inp = self.cnn_block(Ximg)
###########################
roi_inp = roi_pool(cnn_inp, Xroi, self.rsize)
###########################
inp = roi_inp.view(500, 51277)
fc_inp = self.fc_block(inp)
###########################
classif_out = self.classifier_output(fc_inp)
###########################
regress_out = self.regressor_output(fc_inp)
output = torch.cat((classif_out, regress_out), dim=1)
return classif_out, regress_out
By the way, the model output has a dimension example (500, 5) and therefore the back propagation should find the gradient and update the weights for each of the output vectors with a dimension (5,) maybe this has some kind of error? Also sometimes an error appears “Function ‘AddmmBackward’ returned nan values in its 2th output”