I changed it to this
tp = torch.sum(torch.sum(torch.sum(tpmult, dim=0, keepdim=True))).squeeze()
and it is not giving errors, but I am not sure if this is a right thing or not, because anyways it is a cloned project which I am working on … so not sure how will this affects the training or the process