type or pascriterion = DiceCoeffLoss()
optimizer = torch.optim.Adam(model.parameters(),lr=1e-3,weight_decay=1e-5)
target = model(images)
nb_classes = 2
target = target.to('cuda')
model = model.to('cuda')
target = torch.empty(1, 256, 256, dtype=torch.long).random_(nb_classes)
target = torch.zeros(1, nb_classes, 256, 256).scatter_(1, target.unsqueeze(1), 1)
print (target.shape)
print(labels.shape)
criterion.forward(labels.cuda(),target)te code here

now this error appears
RuntimeError: expected type torch.cuda.FloatTensor but got torch.FloatTensor
also is there something wrong with the size like below ?
torch.Size([1, 2, 256, 256])
torch.Size([2, 1, 256, 256])