Following many messages, I have an error related to inplace operation. I have narrowed it down to a few lines of codes but I still can’t find it.
def getSingleImage(pred):
urineVal = 0.3137255
wallVal = 0.627451
tumorVal = 0.94117647
x = predToSegmentation(pred)
for i in range(x.size(0)):
x[i, 0] = x[i, 0] * 0
x[i, 1] = x[i, 1] * urineVal
x[i, 2] = x[i, 2] * wallVal
x[i, 3] = x[i, 3] * tumorVal
x = x.sum(dim=1, keepdim=True)
return x
def predToSegmentation(pred):
x = pred
for i in range(x.size(0)):
top2 = x[i].topk(2, dim=0)[0]
x[i] = x[i] - top2[1]
x[i] = x[i] / (top2[0] - top2[1])
x[i] = x[i].clamp(0, 1)
return x
Any idea ?
Thanks